コード例 #1
0
        private void NewsList_DataBind()
        {
            if (!DataEval.IsEmptyQuery(_category_selected))
            {
                RadTabStrip_Commands.Visible = true;

                Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();
                ListView_NewsList.DataSource   = myNewsMgr.Get_News_Posts(_category_selected, "ALL", "News_Date", "DESC");
                ListView_NewsList.DataKeyNames = new string[] { "NewsID" };
                ListView_NewsList.DataBind();

                CheckBox chk_SelectAll = (CheckBox)ListView_NewsList.FindControl("chk_SelectAll");
                if (chk_SelectAll != null)
                {
                    chk_SelectAll.Checked = false;
                }
            }
        }
コード例 #2
0
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(_newslistid))
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    ListView_NewsList.Enabled   = false;
                    btn_NewsStatus_Show.Enabled = false;
                }

                #region Bind Data to droplist
                // Enable user edit mode

                //Gets your enum names and adds it to a string array
                Array enumNames = Enum.GetValues(typeof(Lib.News_Status));

                //Creates an ArrayList
                ArrayList myNews_Statuses = new ArrayList();

                //Loop through your string array and poppulates the ArrayList
                foreach (Lib.News_Status myNews_Status in enumNames)
                {
                    myNews_Statuses.Add(new { Value = StringEnum.GetStringValue(myNews_Status), Name = myNews_Status.ToString() });
                }


                //Bind the ArrayList to your DropDownList
                droplist_NewsStatus_Show.DataSource     = myNews_Statuses;
                droplist_NewsStatus_Show.DataTextField  = "Name";
                droplist_NewsStatus_Show.DataValueField = "Value";
                droplist_NewsStatus_Show.DataBind();
                #endregion

                if (DataEval.IsEmptyQuery(_news_status_show))
                {
                    _news_status_show = droplist_NewsStatus_Show.SelectedValue;
                }
                else
                {
                    droplist_NewsStatus_Show.SelectedValue = _news_status_show;
                }

                if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                {
                    //lbtn_Add_News.Visible = true;
                    droplist_NewsStatus_Show.Visible = true;
                    btn_NewsStatus_Show.Visible      = true;
                }
                else
                {
                    //lbtn_Add_News.Visible = false;
                    droplist_NewsStatus_Show.Visible = false;
                    btn_NewsStatus_Show.Visible      = false;
                }

                Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                ListView_NewsList.DataSource   = myNewsMgr.Get_News_Posts(_categoryid, _news_status_show, _sortorder, _orientation, _totalnumber, _newsdetailurl);
                ListView_NewsList.DataKeyNames = new string[] { "NewsID" };

                Core.Tools.AppItemTemplates myItemTemplate = new Core.Tools.AppItemTemplates();

                switch (_itemtemplate)
                {
                case "Default":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_Default.ascx";
                    break;

                case "TitleOnly":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_TitleOnly.ascx";
                    break;

                case "Custom":
                    myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                    break;

                default:
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_Default.ascx";
                    break;
                }

                myItemTemplate.Set_Separator("");
                myItemTemplate.Set_DataEmpty("");

                ListView_NewsList.ItemTemplate            = Page.LoadTemplate(myItemTemplate.ItemTemplatePath);
                ListView_NewsList.AlternatingItemTemplate = Page.LoadTemplate(myItemTemplate.AltPath);

                if (!DataEval.IsEmptyQuery(myItemTemplate.Separator))
                {
                    ListView_NewsList.ItemSeparatorTemplate = Page.LoadTemplate(myItemTemplate.Separator);
                }

                if (!DataEval.IsEmptyQuery(myItemTemplate.DataEmpty))
                {
                    ListView_NewsList.EmptyDataTemplate = Page.LoadTemplate(myItemTemplate.DataEmpty);
                }

                try
                {
                    ListView_NewsList.DataBind();
                }
                catch
                {
                    // Load Template Failed
                }

                DataPager_NewsList.PageSize = _numberperpage;
                DataPager_NewsList.Visible  = _enable_pager;
            }
        }