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_EditAttributeGroup : WebBlocks.AdministrativePage { private int AttributeGroupID { get { return (ViewState["AttributeGroupID"] == null ? 0 : (int)ViewState["AttributeGroupID"]); } set { ViewState["AttributeGroupID"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request["AttributeGroupID"] != null) AttributeGroupID = Int32.Parse(Request["AttributeGroupID"]); BindData(); } } private void BindData() { if (AttributeGroupID > 0) { DataRow dr = Database.AttributeGroups_Get(AttributeGroupID); txtGroupName.Text = (string)dr["GroupName"]; } } protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { if (AttributeGroupID == 0) Database.AttributeGroups_Add(txtGroupName.Text); else Database.AttributeGroups_Update(AttributeGroupID, txtGroupName.Text); Response.Redirect("ManageAttributes.aspx"); } } }