protected void LinkButtonupdate_click(object sender, System.EventArgs e) { CSLOrderingARCBAL.LinqToSqlDataContext db = null; try { pnlGradeDetails.Visible = true; pnlGradeList.Visible = false; litAction.Text = "You choose to <b>EDIT GRADE MAPPING</b>"; LinkButton lbctg = sender as LinkButton; if (lbctg != null) { GridViewRow gvr = (GridViewRow)lbctg.NamingContainer; Label lbl1 = gvr.FindControl("lblProductGradeID") as Label; ViewState["ProductGradeID"] = lbl1.Text; } db = new LinqToSqlDataContext(); var usrDtls = ProductBAL.GetProductGradeById(Convert.ToInt32(ViewState["ProductGradeID"].ToString())); if (usrDtls != null) { txtProductCode.Text = usrDtls.ProductCode; ddlGrade.SelectedValue = usrDtls.Grade.ToString(); } db.Dispose(); } catch (Exception objException) { db = new CSLOrderingARCBAL.LinqToSqlDataContext(); db.USP_SaveErrorDetails(Request.Url.ToString(), "LinkButtonupdate_click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()])); db.Dispose(); } }