protected void ItmQty_TextChanged(object sender, EventArgs e)
        {
            try
            {
                float      GTotal    = 0;
                LinkButton lnkbtnadd = null;
                for (int k = 0; k < GVStkItems.Rows.Count; k++)
                {
                    TextBox total = (TextBox)GVStkItems.Rows[k].FindControl("ItmQty");
                    lnkbtnadd = (LinkButton)GVStkItems.Rows[k].FindControl("lnkbtnadd");

                    if (total.Text != "")
                    {
                        GTotal += Convert.ToSingle(total.Text);
                    }
                }

                TBttlqty.Text = GTotal.ToString();
                lnkbtnadd.Focus();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// method
        /// set the fore color of the specified link button in the selected row
        /// in the specified grid view to the specified color
        /// </summary>
        /// <param name="gv"></param>
        /// <param name="strLinkButtonID"></param>
        /// <param name="strSkinID"></param>
        public static void SetSelectedLinkButtonForeColor(
            GridView gv,
            string strID,
            Color clrForeColor)
        {
            GridViewRow gvrSelected = gv.SelectedRow;

            if (gvrSelected != null)
            {
                LinkButton lnkSelect = (LinkButton)gvrSelected.FindControl(strID);
                if (lnkSelect == null)
                {
                    return;
                }

                lnkSelect.ForeColor = clrForeColor;
                lnkSelect.Focus();
            }
        }
        protected void TBItmQty_TextChanged(object sender, EventArgs e)
        {
            try
            {
                for (int j = 0; j < GV_POS.Rows.Count; j++)
                {
                    TextBox    TBItms    = (TextBox)GV_POS.Rows[j].FindControl("TBItms");
                    TextBox    TBItmQty  = (TextBox)GV_POS.Rows[j].FindControl("TBItmQty");
                    TextBox    tbsalpris = (TextBox)GV_POS.Rows[j].FindControl("tbsalpris");
                    Label      lblttl    = (Label)GV_POS.Rows[j].FindControl("lblttl");
                    Label      lbl_Flag  = (Label)GV_POS.Rows[j].FindControl("lbl_Flag");
                    LinkButton lnkbtnadd = (LinkButton)GV_POS.Rows[j].FindControl("lnkbtnadd");

                    if (TBItms.Text == "")
                    {
                        lbl_Flag.Text = "0";
                    }

                    lblttl.Text = (Convert.ToDouble(TBItmQty.Text.Trim()) * Convert.ToDouble(tbsalpris.Text.Trim())).ToString();
                    lnkbtnadd.Focus();
                }

                float GTotal = 0;
                for (int k = 0; k < GV_POS.Rows.Count; k++)
                {
                    Label  lblttl = (Label)GV_POS.Rows[k].FindControl("lblttl");
                    string ttlamt = Convert.ToDouble(lblttl.Text).ToString();

                    GTotal    += Convert.ToSingle(ttlamt);
                    TBTtl.Text = GTotal.ToString();
                }
            }
            catch (Exception ex)
            {
                lblmssg.Text = ex.Message;
            }
        }