Example #1
0
 private void grdProducts_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Literal literal = (Literal)e.Row.FindControl("litMainCategory");
         literal.Text = "-";
         object obj2 = DataBinder.Eval(e.Row.DataItem, "CategoryId");
         if ((obj2 != null) && (obj2 != DBNull.Value))
         {
             literal.Text = SubsiteCatalogHelper.GetFullCategory((int)obj2);
         }
         DistributorProductCategoriesDropDownList list = (DistributorProductCategoriesDropDownList)e.Row.FindControl("dropAddToCategories");
         list.DataBind();
         Literal literal2 = (Literal)e.Row.FindControl("litExtendCategory");
         literal2.Text = "-";
         object obj3 = DataBinder.Eval(e.Row.DataItem, "ExtendCategoryPath");
         if ((obj3 != null) && (obj3 != DBNull.Value))
         {
             string s = (string)obj3;
             if (s.Length > 0)
             {
                 s = s.Substring(0, s.Length - 1);
                 if (s.Contains("|"))
                 {
                     s = s.Substring(s.LastIndexOf('|') + 1);
                 }
                 literal2.Text      = SubsiteCatalogHelper.GetFullCategory(int.Parse(s));
                 list.SelectedValue = new int?(int.Parse(s));
             }
         }
     }
 }
 private void grdProducts_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
 {
     if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow)
     {
         System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litMainCategory");
         literal.Text = "-";
         object obj = System.Web.UI.DataBinder.Eval(e.Row.DataItem, "CategoryId");
         if (obj != null && obj != System.DBNull.Value)
         {
             literal.Text = SubsiteCatalogHelper.GetFullCategory((int)obj);
         }
         DistributorProductCategoriesDropDownList distributorProductCategoriesDropDownList = (DistributorProductCategoriesDropDownList)e.Row.FindControl("dropAddToCategories");
         distributorProductCategoriesDropDownList.DataBind();
         System.Web.UI.WebControls.Literal literal2 = (System.Web.UI.WebControls.Literal)e.Row.FindControl("litExtendCategory");
         literal2.Text = "-";
         object obj2 = System.Web.UI.DataBinder.Eval(e.Row.DataItem, "ExtendCategoryPath");
         if (obj2 != null && obj2 != System.DBNull.Value)
         {
             string text = (string)obj2;
             if (text.Length > 0)
             {
                 text = text.Substring(0, text.Length - 1);
                 if (text.Contains("|"))
                 {
                     text = text.Substring(text.LastIndexOf('|') + 1);
                 }
                 literal2.Text = SubsiteCatalogHelper.GetFullCategory(int.Parse(text));
                 distributorProductCategoriesDropDownList.SelectedValue = new int?(int.Parse(text));
             }
         }
     }
 }
Example #3
0
 private void grdProducts_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DistributorProductCategoriesDropDownList list = (DistributorProductCategoriesDropDownList)e.Row.FindControl("dropAddToCategories");
         list.SelectedIndexChanged += new EventHandler(dropAddToCategories_SelectedIndexChanged);
     }
 }
 private void grdProducts_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
 {
     if (e.Row.RowType == System.Web.UI.WebControls.DataControlRowType.DataRow)
     {
         DistributorProductCategoriesDropDownList distributorProductCategoriesDropDownList = (DistributorProductCategoriesDropDownList)e.Row.FindControl("dropAddToCategories");
         distributorProductCategoriesDropDownList.SelectedIndexChanged += new System.EventHandler(this.dropAddToCategories_SelectedIndexChanged);
     }
 }
        private void dropAddToCategories_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DistributorProductCategoriesDropDownList distributorProductCategoriesDropDownList = (DistributorProductCategoriesDropDownList)sender;

            System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)distributorProductCategoriesDropDownList.NamingContainer;
            if (distributorProductCategoriesDropDownList.SelectedValue.HasValue)
            {
                SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, SubsiteCatalogHelper.GetCategory(distributorProductCategoriesDropDownList.SelectedValue.Value).Path + "|");
                this.ReBind();
                return;
            }
            SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, null);
            this.ReBind();
        }
Example #6
0
        private void dropAddToCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            DistributorProductCategoriesDropDownList list = (DistributorProductCategoriesDropDownList)sender;
            GridViewRow namingContainer = (GridViewRow)list.NamingContainer;

            if (list.SelectedValue.HasValue)
            {
                SubsiteCatalogHelper.SetProductExtendCategory((int)grdProducts.DataKeys[namingContainer.RowIndex].Value, SubsiteCatalogHelper.GetCategory(list.SelectedValue.Value).Path + "|");
                ReBind();
            }
            else
            {
                SubsiteCatalogHelper.SetProductExtendCategory((int)grdProducts.DataKeys[namingContainer.RowIndex].Value, null);
                ReBind();
            }
        }