示例#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));
             }
         }
     }
 }