protected void uiButtonSearch_Click(object sender, EventArgs e)
 {
     SubCategories objData = new SubCategories();
     objData.GetAllSubCategoriesByCategory(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
     uiGridViewSubCategories.DataSource = objData.DefaultView;
     uiGridViewSubCategories.DataBind();
 }
Example #2
0
 protected void uiDropDownListCategory_SelectedIndexChanged(object sender, EventArgs e)
 {
     SubCategories objSubCategories = new SubCategories();
     objSubCategories.GetAllSubCategoriesByCategory(Convert.ToInt32(uiDropDownListCategory.SelectedValue));
     uiDropDownListSubCategory.DataSource = objSubCategories.DefaultView;
     uiDropDownListSubCategory.DataTextField = "ArName";
     uiDropDownListSubCategory.DataValueField = "SubCategoryID";
     uiDropDownListSubCategory.DataBind();
     uiDropDownListSubCategory.Items.Insert(0, new ListItem("إختر قطاع العمل الفرعى", "0"));
 }
        private void LoadSubcats(int catid)
        {
            PagedDataSource dt = new PagedDataSource();
            SubCategories objData = new SubCategories();
            objData.GetAllSubCategoriesByCategory(catid);
            Categories cat = new Categories();
            cat.LoadByPrimaryKey(catid);

            dt.DataSource = objData.DefaultView;
            dt.AllowPaging = true;
            dt.PageSize = 10;
            dt.CurrentPageIndex = PageIndex;
            if (objData.RowCount > 0 && dt != null)
            {
                if (cat.RowCount > 0)
                    uiLabelTitle.Text = " - " + cat.ArName;

                uiDataListSubCats.DataSource = dt;
                uiDataListSubCats.DataBind();
                uiLinkButtonPrev.Enabled = !dt.IsFirstPage;
                uiLinkButtonNext.Enabled = !dt.IsLastPage;
                uiLabelPages.Text = "صفحة " + (PageIndex + 1).ToString() + " من " + dt.PageCount.ToString() + " صفحات";
                uiPanelNoResults.Visible = false;
                uiPanelCategories.Visible = true;
                uiPanelResults.Visible = false;
            }
            else
            {
                uiPanelCategories.Visible = false;
                uiPanelNoResults.Visible = true;
                uiPanelResults.Visible = false;
            }
        }
        protected void uiRepeaterDir_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView row = (DataRowView)e.Item.DataItem;
                int catid = Convert.ToInt32(row["CategoryID"].ToString());

                SubCategories sub = new SubCategories();
                sub.GetAllSubCategoriesByCategory(catid);

                Literal subs = (Literal)e.Item.FindControl("uiLiteralSub");

                if (sub.RowCount > 0)
                {
                    subs.Text = "<ul>";
                    for (int i = 0; i < sub.RowCount; i++)
                    {
                        subs.Text += "<li><a href=\"/Directory.aspx?cid=" + catid.ToString() + "&scid=" + sub.SubCategoryID.ToString() + "\" >" + sub.ArName + "</a></li>";
                        sub.MoveNext();
                    }
                    subs.Text += "</ul>";
                }
            }
        }
        private void LoadDDLs()
        {
            Cities objCities = new Cities();
            objCities.LoadAll();
            uiDropDownListCity.DataSource = objCities.DefaultView;
            uiDropDownListCity.DataTextField = "ArName";
            uiDropDownListCity.DataValueField = "CityID";
            uiDropDownListCity.DataBind();

            Categories objCats = new Categories();
            objCats.LoadAll();
            uiDropDownListCategory.DataSource = objCats.DefaultView;
            uiDropDownListCategory.DataTextField = "ArName";
            uiDropDownListCategory.DataValueField = "CategoryID";
            uiDropDownListCategory.DataBind();
            uiDropDownListCategory.SelectedIndex = 0;

            SubCategories objSubCat = new SubCategories();
            objSubCat.GetAllSubCategoriesByCategory(Convert.ToInt32(uiDropDownListCategory.SelectedValue));
            uiDropDownListSubCategory.DataSource = objSubCat.DefaultView;
            uiDropDownListSubCategory.DataTextField = "ArName";
            uiDropDownListSubCategory.DataValueField = "SubCategoryID";
            uiDropDownListSubCategory.DataBind();
        }
 protected void uiDropDownListCategory_SelectedIndexChanged(object sender, EventArgs e)
 {
     SubCategories objSubCat = new SubCategories();
     objSubCat.GetAllSubCategoriesByCategory(Convert.ToInt32(uiDropDownListCategory.SelectedValue));
     uiDropDownListSubCategory.DataSource = objSubCat.DefaultView;
     uiDropDownListSubCategory.DataTextField = "ArName";
     uiDropDownListSubCategory.DataValueField = "SubCategoryID";
     uiDropDownListSubCategory.DataBind();
 }
 private void BindData()
 {
     SubCategories objData = new SubCategories();
     objData.GetAllSubCategoriesByCategory(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
     uiGridViewSubCategories.DataSource = objData.DefaultView;
     uiGridViewSubCategories.DataBind();
 }