當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.Repeater類代碼示例

本文整理匯總了C#中System.Web.UI.WebControls.Repeater的典型用法代碼示例。如果您正苦於以下問題:C# Repeater類的具體用法?C# Repeater怎麽用?C# Repeater使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Repeater類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了Repeater類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BindRepeaterWithPaging

        public static PagedDataSource BindRepeaterWithPaging(ref Repeater objRepeater, int currentPage, string strSelectQuery, string strSearchCondition = "", string strAddNewRow = "")
        {
            //create new instance of PagedDataSource
            PagedDataSource objPds = new PagedDataSource();
            DataSet dsBindData = new DataSet();
            DataView dv = new DataView();

            //set number of pages will appear
            objPds.PageSize = csGlobal.pageSize;
            objPds.AllowPaging = true;

            //Fill DataSet And Create Dataview
            dsBindData = CrystalConnection.CreateDatasetWithoutTransaction(strSelectQuery);
            dv = dsBindData.Tables[0].DefaultView;

            //Filter the DataView According to Search Condition
            if (strSearchCondition != "")
            {
                dv.RowFilter = strSearchCondition;
            }

            objPds.DataSource = dv;

            //Setting CurrentPageIndex, Which page is to be set Current Page
            if (strAddNewRow == "")
                objPds.CurrentPageIndex = currentPage;
            else
                objPds.CurrentPageIndex = objPds.PageCount - 1;

            //Bind the Repeader with PageDataSource
            objRepeater.DataSource = objPds;
            objRepeater.DataBind();

            return objPds;
        }
開發者ID:AAGJKPRT,項目名稱:LMT,代碼行數:35,代碼來源:csGlobalFunction.cs

示例2: btnDelete_Click

        //批量刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int sucCount = 0; //成功數量
            int errorCount = 0; //失敗數量
            Repeater rptList = new Repeater();
            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "刪除lbs數據管理內容成功" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            JscriptMsg("刪除成功" + sucCount + "條,失敗" + errorCount + "條!", Utils.CombUrlTxt("lbslist.aspx", "keywords={0}", this.keywords), "Success");
        }
開發者ID:yi724926089,項目名稱:MyWx,代碼行數:27,代碼來源:lbslist.aspx.cs

示例3: BindCourseware

 public void BindCourseware()
 {
     var repeaters = new Repeater[]
     {A0, A1, A2, A3, A4, A5, A6, B0, B1, B2, B3, B4, B5, B6, C0, C1, C2, C3, C4, C5, C6};
     foreach (var repeater in repeaters)
     {
         Func<ResourceMap, bool> funcWhere;
         Func<ResourceMap, dynamic> funcOrder;
         var index = int.Parse(repeater.ID.Substring(1, 1));
         var order = repeater.ID.Substring(0, 1);
         switch (order)
         {
             case "A":
                 funcOrder = o => o.Time;
                 break;
             case "B":
                 funcOrder = o => o.View;
                 break;
             default:
                 funcOrder = o => o.Credit;
                 break;
         }
         funcWhere =
             o => o.Type == ResourceType.課件 && o.State < State.審核 && o.CatalogId == Courses[index];
         repeater.DataSource = HomoryContext.Value.ResourceMap.Where(predicate: funcWhere).OrderByDescending(funcOrder).Take(10).ToList();
         repeater.DataBind();
     }
 }
開發者ID:Homory-Temp,項目名稱:LeYi,代碼行數:28,代碼來源:HomeCourseware.ascx.cs

示例4: UpdateProfile

 public void UpdateProfile(Repeater rpData, Boolean debugMode = false)
 {
     const string profileupload = "NBStore\\profileupload";
     Utils.CreateFolder(PortalSettings.Current.HomeDirectoryMapPath + profileupload);
     var strXml = GenXmlFunctions.GetGenXml(rpData, "", PortalSettings.Current.HomeDirectoryMapPath + profileupload);
     Save(strXml, debugMode);
 }
開發者ID:fujinguyen,項目名稱:NBrightBuy,代碼行數:7,代碼來源:ProfileData.cs

示例5: btnDelete_Click

        //批量刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("weixin_sq", MXEnums.ActionEnum.Delete.ToString()); //檢查權限
            int sucCount = 0; //成功數量
            int errorCount = 0; //失敗數量

            Repeater rptList = new Repeater();
            rptList = this.rptList;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "刪除微信上牆圖片成功" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            Response.Redirect(Utils.CombUrlTxt("photo_list.aspx", "id={0}&keywords={1}",
              aid.ToString(), this.keywords));
        }
開發者ID:yi724926089,項目名稱:MyWx,代碼行數:30,代碼來源:photo_list.aspx.cs

示例6: Loadlist

        public void Loadlist(Repeater rpt)
        {
            try
            {
                int sotin = (_typecat == 0 ? lnews.Getsotin(_Catid) : 100);
                var list = lnews.Load_listnews(_Catid);
                if (list.Count > 0)
                {
                    //if (_page != 0)
                    //{
                    //    rpt.DataSource = list.Skip(sotin * _page - sotin).Take(sotin);
                    //    rpt.DataBind();
                    //}
                    //else
                    //{
                    rpt.DataSource = list;//.Take(sotin);
                    rpt.DataBind();
                    //}
                    //ltrPage.Text = change.result(list.Count, sotin, _cat_seo_url, 0, _page, 1);
                }
                else { }

            }
            catch
            {

            }
        }
開發者ID:htphongqn,項目名稱:kibitravel,代碼行數:28,代碼來源:enListDestinations.ascx.cs

示例7: GetCheckBoxByRepeater

        /// <summary>
        /// 獲得Repeater中已選的CheckBox值集合
        /// </summary>
        /// <param name="list">列表控件</param>
        /// <param name="checkId">CheckBox名稱</param>
        /// <returns></returns>
        public static string GetCheckBoxByRepeater(Repeater list, string checkId)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            StringBuilder rets = new StringBuilder();
            for (int i = 0; i < list.Items.Count; i++)
            {
                CheckBox check = (CheckBox) list.Items[i].FindControl(checkId);
                if (check.Checked)
                {
                    if (rets.Length > 0)
                    {
                        rets.Append(",");
                        rets.Append(check.Text);
                    }
                    else
                    {
                        rets.Append(check.Text);
                    }
                }
            }
            return rets.ToString();
        }
開發者ID:BGCX261,項目名稱:zhuji-cms-svn-to-git,代碼行數:32,代碼來源:UIControlHelper.cs

示例8: BindMenu

 /// <summary>
 /// BindMenu
 /// </summary>
 /// <param name="web"></param>
 /// <param name="listName"></param>
 /// <param name="rptMenu"></param>
 /// <param name="menuPosition"></param>
 /// <param name="menuParent"></param>
 public static void BindMenu(SPWeb web, string listName, Repeater rptMenu, string menuPosition, string menuParent)
 {
     SPSecurity.RunWithElevatedPrivileges(() =>
     {
         using (var adminSite = new SPSite(web.Site.ID))
         {
             using (var adminWeb = adminSite.OpenWeb(web.ID))
             {
                 try
                 {
                     adminWeb.AllowUnsafeUpdates = true;
                     string caml = @"<Where><And><Eq><FieldRef Name='{0}' /><Value Type='Text'>{1}</Value></Eq><Eq><FieldRef Name='{2}' /><Value Type='MultiChoice'>{3}</Value></Eq></And></Where><OrderBy><FieldRef Name='{4}' /></OrderBy>";
                     var query = new SPQuery()
                     {
                         Query = string.Format(CultureInfo.InvariantCulture, caml, FieldsName.MenuList.InternalName.ParentID, menuParent, FieldsName.MenuList.InternalName.MenuPosition, menuPosition, FieldsName.MenuList.InternalName.MenuOrder)
                     };
                     var list = Utilities.GetCustomListByUrl(adminWeb, listName);
                     var items = list.GetItems(query);
                     if (items != null && items.Count > 0)
                     {
                         rptMenu.DataSource = items.GetDataTable();
                         rptMenu.DataBind();
                     }
                 }
                 catch (SPException ex)
                 {
                     Utilities.LogToULS(ex);
                 }
             }
         }
     });
 }
開發者ID:setsunafjava,項目名稱:vpsp,代碼行數:40,代碼來源:MenuBO.cs

示例9: Loadlist

        public void Loadlist(Repeater rpt)
        {
            try
            {
                int sotin = (_typecat == 0 ? lnews.Getsotin(_Catid) : 100);
                var list = lnews.Load_listnews(_Catid);
                if (list.Count > 0)
                {
                    if (_page != 0)
                    {
                        rpt.DataSource = list.Skip(sotin * _page - sotin).Take(sotin);
                        rpt.DataBind();
                    }
                    else
                    {
                        rpt.DataSource = list.Take(sotin);
                        rpt.DataBind();
                    }
                    ltrPage.Text = change.result(list.Count, sotin, _cat_seo_url, 0, _page, 1);
                }
                else { lblMsg.Text = "Nội dung đang được cập nhật!"; }

            }
            catch (Exception)
            {

                throw;
            }
        }
開發者ID:htphongqn,項目名稱:ecobuild,代碼行數:29,代碼來源:ListNews.ascx.cs

示例10: btnSave_Click

 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString()); //檢查權限
     BLL.article bll = new BLL.article();
     Repeater rptList = new Repeater();
     switch (this.prolistview)
     {
         case "Txt":
             rptList = this.rptList1;
             break;
         default:
             rptList = this.rptList2;
             break;
     }
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "頻道內容排序"); //記錄日誌
     JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
         this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
開發者ID:LutherW,項目名稱:MTMS,代碼行數:29,代碼來源:article_list.aspx.cs

示例11: btnAudit_Click

 //批量審核
 protected void btnAudit_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Audit.ToString()); //檢查權限
     BLL.article bll = new BLL.article();
     Repeater rptList = new Repeater();
     switch (this.prolistview)
     {
         case "Txt":
             rptList = this.rptList1;
             break;
         default:
             rptList = this.rptList2;
             break;
     }
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.UpdateField(id, "status=0");
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "審核" + this.channel_name + "頻道內容信息"); //記錄日誌
     JscriptMsg("批量審核成功!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
         this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property));
 }
開發者ID:sfwjiao,項目名稱:MyTestProject,代碼行數:28,代碼來源:article_list.aspx.cs

示例12: btnDelete_Click

        //批量刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Delete.ToString()); //檢查權限
            int sucCount = 0; //成功數量
            int errorCount = 0; //失敗數量
            BLL.article bll = new BLL.article();
            Repeater rptList = new Repeater();
            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "刪除" + this.channel_name + "單頁內容成功" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            JscriptMsg("刪除成功" + sucCount + "條,失敗" + errorCount + "條!", Utils.CombUrlTxt("article_page_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
                this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
        }
開發者ID:yi724926089,項目名稱:MyWx,代碼行數:30,代碼來源:article_page_list.aspx.cs

示例13: btnDelete_Click

 //批量刪除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("link", OSEnums.ActionEnum.Delete.ToString()); //檢查權限
     int sucCount = 0; //成功數量
     int errorCount = 0; //失敗數量
     BLL.contents.article bll = new BLL.contents.article();
     Repeater rptList = new Repeater();
       rptList = this.rptList1;
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount++;
             }
             else
             {
                 errorCount++;
             }
         }
     }
         AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "刪除[搜索-"+this.keywords+"]頻道內容成功" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
         Response.Redirect(Utils.CombUrlTxt("search.aspx", "keywords={0}", this.keywords));
 }
開發者ID:eyren,項目名稱:OScms,代碼行數:28,代碼來源:search.aspx.cs

示例14: InitializeSkin

 protected override void InitializeSkin(System.Web.UI.Control Skin)
 {
     Repeater1 = (Repeater)Skin.FindControl("Repeater1");
     Button1 = (Button)Skin.FindControl("Button1");
     Button1.Click += new EventHandler(Button1_Click);
     DataBind();
 }
開發者ID:LittlePeng,項目名稱:ncuhome,代碼行數:7,代碼來源:Message.cs

示例15: btnSave_Click

 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.goods bll = new BLL.goods();
     Repeater rptList = new Repeater();
     switch (this.prolistview)
     {
         case "Txt":
             rptList = this.rptList1;
             break;
         default:
             rptList = this.rptList2;
             break;
     }
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
     this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
開發者ID:codefighting,項目名稱:shouxinzhihui,代碼行數:27,代碼來源:list.aspx.cs


注:本文中的System.Web.UI.WebControls.Repeater類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。