コード例 #1
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //TextBox t1, t2, t3;
        GridViewRow row   = GridView1.Rows[e.RowIndex];
        Label       lblno = (Label)row.FindControl("lblsmno");
        long        smid  = long.Parse(lblno.Text);
        //long smid = long.Parse(((Label)row.Cells[0].Controls[0]).Text);
        //long pcid = long.Parse(((TextBox)row.Cells[1].Controls[0]).Text);
        //long pcid = long.Parse(GridView1.DataKeys[row_index]["ProductId"].ToString());
        string id     = GridView1.DataKeys[e.RowIndex].Value.ToString();
        long   pcid   = long.Parse(id);
        string pcname = ((TextBox)row.FindControl("txtpcname")).Text;
        string smname = ((TextBox)row.FindControl("txsmname")).Text;

        smobj.ProductCategoryID       = pcid;
        pcobj.ProductCategoryID       = pcid;
        smobj.SpecificationMasterID   = smid;
        pcobj.ProductCategoryName     = pcname;
        smobj.SpecificationMasterName = smname;
        smobj.UpdateSpecificationMaster();
        pcobj.UpdateProductCategory();
        GridView1.EditIndex = -1;

        // binddata();
        BindSpecData();
    }
コード例 #2
0
 protected void RenameCategoryButton_Click(object sender, EventArgs e)
 {
     if (this.RequiredCategoryNameValidator.IsValid)
     {
         int             currentCategoryId = this.CategoryPath.CurrentCategoryId;
         ProductCategory productCategory   = new ProductCategory
         {
             CategoryID          = currentCategoryId,
             CategoryHtmlName    = base.Server.HtmlEncode(this.txtEditCategoryName.Text),
             CategoryDescription = base.Server.HtmlEncode(this.txtEditCategoryDescription.Text)
         };
         ProductCategories.UpdateProductCategory(productCategory);
         CategoryCache.ClearCategoryCache();
         this.txtEditCategoryDescription.Text = string.Empty;
         this.txtEditCategoryName.Text        = string.Empty;
         this.CategoryDropDown.Refresh();
         this.SetCurrentCategory(currentCategoryId);
     }
 }