/// <summary>
        /// 绑定选项分组框到页面
        /// </summary>
        private void BindCategoriesToPage()
        {
            //获取效果参数
            List <SettingEntity> LayerOptions = Setting_LayerSettingDB;

            LayerOptions = LayerOptions.FindAll(r => String.IsNullOrEmpty(r.Layout) || (String.IsNullOrEmpty(LayerType) && String.IsNullOrEmpty(r.Layout)) ||
                                                (!String.IsNullOrEmpty(LayerType) && r.Layout.IndexOf(LayerType, StringComparison.CurrentCultureIgnoreCase) >= 0));


            List <KeyValueEntity> Items = new List <KeyValueEntity>();

            foreach (SettingEntity ItemSetting in LayerOptions)
            {
                if (!Items.Exists(r1 => r1.Key == ItemSetting.Categories))
                {
                    Items.Add(new KeyValueEntity(ItemSetting.Categories, ""));
                }
            }

            if (!(Items != null && Items.Count > 0))
            {
                Items.Add(new KeyValueEntity("Basic Categories", ""));
            }
            //绑定参数项
            RepeaterCategories.DataSource = Items;
            RepeaterCategories.DataBind();
        }
Пример #2
0
        /// <summary>
        /// 绑定选项分组框到页面
        /// </summary>
        private void BindCategoriesToPage()
        {
            //获取效果参数
            List <SettingEntity> ItemSettingDB = OptionList;

            List <KeyValueEntity> Items = new List <KeyValueEntity>();

            Items.Add(new KeyValueEntity("Basic Categories", ""));
            foreach (SettingEntity ItemSetting in ItemSettingDB)
            {
                if (!Items.Exists(r1 => r1.Key == ItemSetting.Categories))
                {
                    Items.Add(new KeyValueEntity(ItemSetting.Categories, ""));
                }
            }

            if (Items != null && Items.Count > 0)
            {
                //绑定参数项
                RepeaterCategories.DataSource = Items;
                RepeaterCategories.DataBind();
            }
        }
Пример #3
0
 private void LoadCategories()
 {
     RepeaterCategories.DataSource = DB.getLidtCategories();
     RepeaterCategories.DataBind();
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    //for results
                    ResultModel model  = new ResultModel();
                    var         result = model.GetResult();
                    Repeater2.DataSource = result;
                    Repeater2.DataBind();

                    //for blogs
                    string Text       = Convert.ToString(Request.QueryString["SearchText"]);
                    int    categoryId = Convert.ToInt32(Request.QueryString["CategoryId"]);
                    SearchPaging.Value = Convert.ToString(categoryId);

                    BlogModel objblogModel = new BlogModel();
                    var       results      = objblogModel.getBlog(categoryId);
                    if (results.Count() == 0)
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text    = "No Item to Dispaly";
                    }

                    int PageIndex          = 0;
                    int PageSize           = 3;
                    int skip               = PageIndex * PageSize;
                    int PageCount          = Convert.ToInt32(Convert.ToDouble(Math.Ceiling((double)((double)results.Count() / (double)PageSize))));
                    List <BlogModel> query = results.Skip(skip).Take(PageSize).ToList();
                    BlogRepeater.DataSource = query;
                    BlogRepeater.DataBind();
                    List <PageModel> paging = new List <PageModel>();
                    Boolean          active = false;
                    for (int i = 0; i < PageCount; i++)
                    {
                        if (i == 0)
                        {
                            active = true;
                        }
                        else
                        {
                            active = false;
                        }
                        paging.Add(new PageModel
                        {
                            pageindex  = i,
                            pagename   = i + 1,
                            pageactive = active,
                        });
                    }
                    Repeater1.DataSource = paging;
                    Repeater1.DataBind();

                    //for categories
                    CategoryModel objcategory = new CategoryModel();
                    var           categories  = objcategory.GetCategory();
                    RepeaterCategories.DataSource = categories;
                    RepeaterCategories.DataBind();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(" + ex.Message + ")", true);
            }
        }