Esempio n. 1
0
        protected void ImgGroupEdit_Click(object sender, EventArgs e)
        {
            lblMessage.Text = "";
            List <Inv_ProductGroup> groups = new List <Inv_ProductGroup>();
            ImageButton             imgbtn = (ImageButton)sender;
            GridViewRow             row    = (GridViewRow)imgbtn.NamingContainer;

            try
            {
                string groupId    = "";
                Label  lblGroupId = (Label)grdProductGroup.Rows[row.RowIndex].FindControl("lblGroupId");
                if (lblGroupId != null)
                {
                    groupId = lblGroupId.Text;
                    groups  = groupBll.GetGroupById(groupId);

                    if (groups.Count > 0)
                    {
                        foreach (Inv_ProductGroup agroup in groups)
                        {
                            hdfProductGroupID.Value = agroup.GroupId.ToString();
                            txtGroupName.Text       = agroup.GroupName;
                        }
                        if (btnSubmit.Text == "Submit")
                        {
                            btnSubmit.Text = "Update";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }