protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Bind(); if (!string.IsNullOrEmpty(Request["enum"])) { string enumName = Request["enum"].Trim(new char[]{'【','】'}); txtName.Text = enumName; EnuminfoBLL dal = new EnuminfoBLL(); EnumInfoModel info = dal.GetModel(enumName, SlnID.ToString()); if (info != null) { txtDescription.Text = info.enumDescription; txtValueInfo.Text = info.enumValueInfo; AddorEditMode(true); EditKey.Text = info.ID.ToString(); } else { txtName.Text = enumName; AddorEditMode(false); } } } }
protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); switch (e.CommandName) { case "sel": { EnuminfoBLL con = new EnuminfoBLL(); EnumInfoModel info = con.GetModel(id); txtName.Text = info.enumName; txtDescription.Text = info.enumDescription; txtValueInfo.Text = info.enumValueInfo; AddorEditMode(true); EditKey.Text = e.CommandArgument.ToString(); } break; case "del": { EnuminfoBLL con = new EnuminfoBLL(); con.Delete(id); Bind(); } break; } }