protected void btUpdate_Click(object sender, EventArgs e) { CategoryLv2 obj = new CategoryLv2(); int nID = Convert.ToInt32(Request.QueryString["nid"]); string sName = txtName.Text; string sAction = Request.QueryString["action"].ToString(); switch (sAction) { case "add": if (obj.insert(sName) > 0) { string sUrl = "~/Admin/Administrator.aspx?page=lv2&message=1"; Response.Redirect(sUrl); } break; case "edit": if (obj.update(nID, sName) > 0) { string sUrl = "~/Admin/Administrator.aspx?page=lv2&message=2"; Response.Redirect(sUrl); } break; } }
private void BindataToRpt() { CategoryLv2 obj = new CategoryLv2(); rptCatlv2.DataSource = obj.GetAll(); rptCatlv2.DataBind(); }
private void BindataToDdl() { CategoryLv2 obj = new CategoryLv2(); DataTable dtb = new DataTable(); dtb = obj.GetAll(); ddlCategoryLv2.DataSource = dtb; ddlCategoryLv2.DataValueField = "CategoryLv2ID"; ddlCategoryLv2.DataTextField = "Description"; ddlCategoryLv2.DataBind(); }
private void LoadData() { string sAction = Request.QueryString["action"].ToString(); if (sAction == "edit") { int nID = Convert.ToInt32(Request.QueryString["nid"]); CategoryLv2 obj = new CategoryLv2(); DataTable dtb = obj.getByID(nID); txtName.Text = dtb.Rows[0]["Description"].ToString(); } }
protected void rptAdministrator_ItemCommand(object source, RepeaterCommandEventArgs e) { string strCommand = e.CommandName; int nID = Convert.ToInt32(e.CommandArgument); CategoryLv2 obj = new CategoryLv2(); switch (strCommand) { case "Delete": int nDelete = obj.delete(nID); this.BindataToRpt(); break; case "Edit": string sEdit = "~/Admin/Administrator.aspx?page=lv2edit&action=edit&nid=" + nID; Response.Redirect(sEdit); break; } }