示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Request.QueryString["pcod"] == null)
         {
             TabContainer1.Tabs[1].Enabled = false;
             TabContainer1.Tabs[2].Enabled = false;
         }
         else
         {
             ViewState["cod"] = Request.QueryString["pcod"];
             bind();
             bind1();
             nsuncarte.clsprd           obj = new nsuncarte.clsprd();
             List <nsuncarte.clsprdprp> k   = obj.fnd_rec(Convert.ToInt32
                                                              (Request.QueryString["pcod"]));
             TextBox1.Text = k[0].prdtit;
             TextBox2.Text = k[0].prdreldat.ToShortDateString();
             TextBox3.Text = k[0].prdmrkprc.ToString();
             TextBox7.Text = k[0].prddsc;
             DropDownList1.DataBind();
             DropDownList1.SelectedIndex = -1;
             nsuncarte.clssubcat           obj1 = new nsuncarte.clssubcat();
             List <nsuncarte.clssubcatprp> k1   = obj1.fnd_rec(k[0].prdsubcatcod);
             DropDownList1.Items.FindByValue(k1[0].subcatcatcod.ToString()).Selected = true;
             DropDownList2.DataBind();
             DropDownList2.SelectedIndex = -1;
             DropDownList2.Items.FindByValue(k[0].prdsubcatcod.ToString()).Selected = true;
             Button1.Text = "Update";
         }
         TabContainer1.ActiveTabIndex = 0;
     }
 }
示例#2
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     nsuncarte.clssubcat    obj    = new nsuncarte.clssubcat();
     nsuncarte.clssubcatprp objprp = new nsuncarte.clssubcatprp();
     objprp.subcatcod = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]);
     obj.del_rec(objprp);
     GridView1.DataBind();
     e.Cancel = true;
 }
示例#3
0
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        nsuncarte.clssubcat           obj = new nsuncarte.clssubcat();
        List <nsuncarte.clssubcatprp> x   = obj.fnd_rec(Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex][0]));

        DropDownList1.SelectedIndex = -1;
        DropDownList1.Items.FindByValue(x[0].subcatcatcod.ToString()).Selected = true;
        TextBox1.Text    = x[0].subcatnam;
        ViewState["cod"] = x[0].subcatcod;
        Button1.Text     = "Update";
        e.Cancel         = true;
    }
示例#4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     nsuncarte.clssubcat    obj    = new nsuncarte.clssubcat();
     nsuncarte.clssubcatprp objprp = new nsuncarte.clssubcatprp();
     objprp.subcatnam    = TextBox1.Text;
     objprp.subcatcatcod = Convert.ToInt32(DropDownList1.SelectedValue);
     if (Button1.Text == "Submit")
     {
         obj.save_rec(objprp);
     }
     else
     {
         objprp.subcatcod = Convert.ToInt32(ViewState["cod"]);
         obj.upd_rec(objprp);
         Button1.Text = "Submit";
     }
     GridView1.DataBind();
     TextBox1.Text = String.Empty;
 }