protected void imgButtonEidt_Click(object sender, ImageClickEventArgs e) { try { ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; Label lblFactoryId = (Label)grdFactory.Rows[row.RowIndex].FindControl("lblFactoryId"); int fqId = Convert.ToInt16(lblFactoryId.Text); LC_Factory _FactoryS = _factorybLL.GetFactoryLById(fqId); if (_FactoryS != null) { hidFactoryd.Value = _FactoryS.FactoryId.ToString(); txtFactoryName.Text = _FactoryS.FactoryName; txtFactoryCode.Text = _FactoryS.FactoryCode; txtContactPerson.Text = _FactoryS.ContactPerson1; txtFactoryEmail.Text = _FactoryS.FactoryEmail; txtFactoryMobile.Text = _FactoryS.FactoryMobile; txtFactoryAddress.Text = _FactoryS.FactoryAddress; } btnSave.Text = "Update"; } catch (Exception ex) { throw ex; } }