using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Admin_ManageAttributes : WebBlocks.AdministrativePage { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindData(); } } private void BindData() { DataTable dt = Database.AttributeGroups_GetAll(); gvAttributeGroups.DataSource = dt; gvAttributeGroups.DataBind(); dt = Database.Attributes_GetAll(); gvAttributes.DataSource = dt; gvAttributes.DataBind(); } protected void gvAttributes_RowCommand(object sender, GridViewCommandEventArgs e) { int RowIndex = Int32.Parse((string)e.CommandArgument); int AttributeID = (int)gvAttributes.DataKeys[RowIndex].Value; if (e.CommandName == "del") { Database.Attributes_Delete(AttributeID); } BindData(); } protected void gvAttributeGroups_RowCommand(object sender, GridViewCommandEventArgs e) { int RowIndex = Int32.Parse((string)e.CommandArgument); int AttributeGroupID = (int)gvAttributeGroups.DataKeys[RowIndex].Value; if (e.CommandName == "del") { Database.AttributeGroups_Delete(AttributeGroupID); } BindData(); } protected void gvAttributeGroups_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lb = (LinkButton)e.Row.Cells[2].Controls[0]; lb.OnClientClick = "return confirm('Are you sure you want to delete this attribute group?')"; } } protected void gvAttributes_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lb = (LinkButton)e.Row.Cells[3].Controls[0]; lb.OnClientClick = "return confirm('Are you sure you want to delete this attribute?')"; } } }