Example #1
0
 protected void uiRepeaterCats_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         DataRowView row = (DataRowView)e.Item.DataItem;
         SubCategory subs = new SubCategory();
         subs.GetSubCategoryByCategoryID(Convert.ToInt32(row["CategoryID"].ToString()));
         if (subs.RowCount > 0)
         {
             Repeater subrep = (Repeater)e.Item.FindControl("uiRepeaterSubcats");
             subrep.DataSource = subs.DefaultView;
             subrep.DataBind();
         }
     }
 }
 private void BindSubCatsForEdit()
 {
     SubCategory subcats = new SubCategory();
     if (uiDropDownListEdit_Category.SelectedIndex != -1)
         subcats.GetSubCategoryByCategoryID(Convert.ToInt32(uiDropDownListEdit_Category.SelectedValue));
     uiDropDownListEditSubCat.DataSource = subcats.DefaultView;
     uiDropDownListEditSubCat.DataTextField = "Name";
     uiDropDownListEditSubCat.DataValueField = "SubCategoryID";
     uiDropDownListEditSubCat.DataBind();
     uiDropDownListEditSubCat.Items.Insert(0, new ListItem("إختر قسم فرعى. . . ."));
 }