protected void gvProductCategory_RowEditing(object sender, GridViewEditEventArgs e) { try { int productCategoryID = (int)gvProductCategory.DataKeys[e.NewEditIndex].Value; FBFoodInventoryController controller = new FBFoodInventoryController(); FBFoodInventoryInfo item = controller.FBProductCategory_GetByID(this.ModuleId, productCategoryID); if (item != null) { panelGrid.Visible = false; panelEdit.Visible = true; txtProductCategory.Text = item.ProductCategory.ToString(); txtProductCategoryID.Value = item.ProductCategoryID.ToString(); rblIsActive.SelectedValue = item.IsActive.ToString(); } else { txtProductCategoryID.Value = ""; } e.Cancel = true; } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }