protected void CategoryGrid_SelectedIndexChanged(object sender, EventArgs e) { lblMessage.Text = ""; GridViewRow gvRow = CategoryGrid.SelectedRow; int categoryID = int.Parse(gvRow.Cells[1].Text); DataTable categoryTable = AdminCategories.GetCategory(categoryID); if (categoryTable.Rows.Count > 0) { hdnCategoryID.Value = categoryID.ToString(); DataRow row = categoryTable.Rows[0]; selectedCategory.Text = row["CategoryName"].ToString(); lblSelectedCategory.Text = row["CategoryName"].ToString(); } }
protected void CategoryGrid_SelectedIndexChanged(object sender, EventArgs e) { lblMessage.Text = ""; GridViewRow gvRow = CategoryGrid.SelectedRow; int categoryID = int.Parse(gvRow.Cells[1].Text); DataTable categoryTable = AdminCategories.GetCategory(categoryID); if (categoryTable.Rows.Count > 0) { hdnCategoryID.Value = categoryID.ToString(); DataRow row = categoryTable.Rows[0]; selectedCategory.Text = row["CategoryName"].ToString(); btnDeleteCategory.Enabled = true; CategoryEdit.Visible = true; tbCategoryName.Text = row["CategoryName"].ToString(); tbCategoryDesc.Text = row["CategoryDesc"].ToString(); cbCategoryAvailable.Checked = bool.Parse(row["CategoryAvailable"].ToString()); AddNewCategoryDiv.Visible = false; } }