• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ListItemCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ListItemCollection的典型用法代码示例。如果您正苦于以下问题:C# ListItemCollection类的具体用法?C# ListItemCollection怎么用?C# ListItemCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListItemCollection类属于命名空间,在下文中一共展示了ListItemCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     var bornCities = new ListItemCollection()
     {
         "",
         "San Salvador",
         "Aguilares",
         "Apopa",
         "Ayutuxtepeque",
         "Cuscatancingo",
         "Delgado",
         "El Paisnal",
         "Guazapa",
         "Ilopango",
         "Mejicanos",
         "Nejapa",
         "Panchimalco",
         "Rosario de Mora",
         "San Marcos",
         "San Martín",
         "Santiago Texacuangos",
         "Santo Tomás",
         "Soyapango",
         "Tonacatepeque",
                 };
     personBornCitySelect.DataSource = bornCities;
     if (!Page.IsPostBack)
     {
         personBornCitySelect.DataBind();
     }
 }
开发者ID:rejbarrera,项目名称:udbASP,代码行数:31,代码来源:SubirImagen.aspx.cs


示例2: AddGroupReturnsFalseIfGroupAlreadyExists

        public void AddGroupReturnsFalseIfGroupAlreadyExists()
        {
            var list = new ListItemCollection<string>();

            var toAdd = new List<string>
            {
                "Foo",
                "Bar"
            };

            var toAddSecond = new List<string>
            {
                "Foo",
                "Bar",
                "Hello"
            };

            list.AddGroup("Bob", toAdd).Should().BeTrue();
            list.AddGroup("Bob", toAddSecond).Should().BeFalse();

            list.Count.Should().Be(1);
            list[0].Title.Should().Be("Bob");

            list[0].Should().ContainInOrder(toAdd);
            list[0].Should().OnlyContain(s => toAdd.Contains(s));
            list[0].Count.Should().Be(2);
        }
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:27,代码来源:ListItemCollectionTest.cs


示例3: ExecuteSQL

    public static ListItemCollection ExecuteSQL(string sql = "", string text = "", string value = "",
        List<SqlParameter> parameters = null)
    {
        ListItemCollection lic = new ListItemCollection(); 
        using (SqlConnection conn = new SqlConnection(Connection))
        {
            conn.Open();
            using (SqlCommand cmd = new SqlCommand(sql, conn))
            {
                if (parameters != null)
                {
                    cmd.Parameters.AddRange(parameters.ToArray());
                }

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read()) 
                        {
                            lic.Add(new ListItem(reader[text].ToString(),
                                reader[value].ToString()));
                        }
                    }
                }
            }
        }

        return lic; 
    }
开发者ID:dmazak,项目名称:Booksite,代码行数:30,代码来源:Database.cs


示例4: Add_Click

    protected void Add_Click(object sender, EventArgs e)
    {
        ListItemCollection removeList = new ListItemCollection();
        // deselect all items
        foreach (ListItem item in SelectedMembers.Items)
        {
            item.Selected = false;
        }

        for (int i = 0; i < AvailableMembers.Items.Count; i++)
        {
            ListItem li = AvailableMembers.Items[i];
            if (!li.Selected) continue;

            // check to see if user is already selected
            IUserActivity attendee = Activity.Attendees.FindAttendee(li.Value);
            if (attendee != null) continue;

            li.Attributes.Add("style", "color:lightgrey");
            li.Attributes.Add("status", "unconfirmed");
            SelectedMembers.Items.Add(li);
            Activity.Attendees.Add(li.Value);
            removeList.Add(li);
        }

        foreach (ListItem li in removeList)
        {
            AvailableMembers.Items.Remove(li);
        }
    }
开发者ID:pebre77,项目名称:PrxS2,代码行数:30,代码来源:AddMembers.ascx.cs


示例5: Bind

 public static void Bind(RadioButtonList rdolst, ListItemCollection list)
 {
     foreach (ListItem item in list)
     {
         rdolst.Items.Add(item);
     }
 }
开发者ID:moinul,项目名称:funny-donkey,代码行数:7,代码来源:RdoListBoxHelper.cs


示例6: OnEnable

 void OnEnable()
 {
     mCollection = new ListItemCollection();
     for (int i = 0; i < 20; i++) {
         mCollection.Add(new LabelListItem("Item " + i.ToString() + " example"));
     }
 }
开发者ID:pLawitzki,项目名称:EditorGUIExt,代码行数:7,代码来源:ItemListExampleWindow.cs


示例7: Page_Load

    public void Page_Load()
    {
        try
        {
            if (!IsPostBack)
            {
                ListItemCollection c = new ListItemCollection();
                c.Add(new ListItem("Total Posts", TransitStats.PostsCount.ToString()));
                c.Add(new ListItem("Total Images", TransitStats.ImagesCount.ToString()));
                if (!DisqusEnabled)
                {
                    c.Add(new ListItem("Total Comments", TransitStats.CommentsCount.ToString()));
                }
                if (SessionManager.CountersEnabled)
                {
                    c.Add(new ListItem("Rss Hits", string.Format("{0} since {1}",
                        TransitStats.RssCount.Count, TransitStats.RssCount.Created.ToString("d"))));
                    c.Add(new ListItem("Atom Hits", string.Format("{0} since {1}",
                        TransitStats.AtomCount.Count, TransitStats.AtomCount.Created.ToString("d"))));
                }
                grid.DataSource = c;
                grid.DataBind();

                summaryLinks.Visible = SessionManager.CountersEnabled;
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
开发者ID:dblock,项目名称:dblog,代码行数:31,代码来源:StatsSummary.aspx.cs


示例8: AddTradeItems

    protected void AddTradeItems( int TradeId, int TeamId, ListItemCollection List )
    {
        foreach ( ListItem i in List )
        {
            if ( i.Selected )
            {
                int Id = int.Parse( i.Value.Substring( 1 ) );
                int PlayerId = -1;
                int PickId = -1;
                if ( i.Value.ToCharArray()[0] == 'd' )
                {
                    PickId = Id;
                }
                else
                {
                    PlayerId = Id;
                }

                int DontCare = ( int )SqlHelper.ExecuteScalar(
                    System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"],
                    "spAddTradeItem",
                    TradeId,
                    TeamId,
                    PickId,
                    PlayerId
                );
            }
        }
    }
开发者ID:ohri,项目名称:netba_dotnet2,代码行数:29,代码来源:TradePropose.aspx.cs


示例9: ProcessItems

        private static void ProcessItems(ListItemCollection items)
        {
            //foreach (var item in items)
            //    Console.WriteLine(item.Id);

            totalCount += items.Count;
            Console.WriteLine("Batch count : " + items.Count);
        }
开发者ID:tandis,项目名称:PnP,代码行数:8,代码来源:Program.cs


示例10: btnPreview_Click

    /// <summary>
    /// Previews the event info entered by the user in a new window.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnPreview_Click(object sender, EventArgs e)
    {
        if (this.IsValid)
        {
            string WebinarRecordingID = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("WebinarRecordingID");

            // if showing criteria for an existing event
            if (WebinarRecordingID != "")
            {
                ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/VideoDetails.aspx?WebinarRecordingID=" + WebinarRecordingID + "','','height=580,width=600,scrollbars=1,resizable=1');", true);
            }
            else
            {
                Session["WebinarVideoDisplayTitle"] = lblDisplayTitle.Text;

                Session["WebinarVideoRegistrationURL"] = CareerCruisingWeb.CCLib.Common.Strings.GenerateHttpLink(txtRegistrationUrl.Text.Trim());

                string commandText = "SELECT Description FROM Webinar_DescriptionsLookup WHERE WebinarDescriptionID = " + ddlListTitle.SelectedValue;
                string webinarDescription = CareerCruisingWeb.CCLib.Common.DataAccess.GetValue(commandText).ToString();
                Session["WebinarVideoDescription"] = webinarDescription;

                Session["WebinarVideoPresenterFullName"] = ddlPresenter.SelectedItem.Text;

                commandText = "SELECT Title, Bio, PhotoImagePath FROM Webinar_PresenterLookup  WHERE WebinarPresenterID = " + ddlPresenter.SelectedValue;
                DataRow presenterInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText).Rows[0];
                Session["WebinarVideoPresenterTitle"] = presenterInfo["Title"].ToString();
                Session["WebinarVideoPresenterBio"] = presenterInfo["Bio"].ToString();
                Session["WebinarVideoPresenterPhotoImagePath"] = presenterInfo["PhotoImagePath"].ToString();
                Session["WebinarVideoRecordingDate"] = DateTime.Parse(txtSessionDates.Text.Trim()).ToString("MM/dd/yyyy");
                commandText = "SELECT wal.WebinarAudienceID, wal.AudienceDescription_EN ";
                commandText += "FROM Webinar_AudienceLookup wal ";
                commandText += "INNER JOIN Webinar_DescriptionsAudience wda ON wal.WebinarAudienceID = wda.WebinarAudienceID ";
                commandText += "WHERE wda.WebinarDescriptionID = " + ddlListTitle.SelectedValue;
                commandText += "GROUP BY wal.AudienceDescription_EN, wal.WebinarAudienceID ";
                commandText += "ORDER BY wal.AudienceDescription_EN";

                DataTable webinarAudience = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText);

                if (webinarAudience.Rows.Count > 0)
                {
                    ListItemCollection collection = new ListItemCollection();

                    foreach (DataRow row in webinarAudience.Rows)
                    {
                        collection.Add(new ListItem(row["AudienceDescription_EN"].ToString()));
                    }

                    Session["WebinarVideoAudienceDescriptionList"] = collection;
                }
                else
                {
                    Session["WebinarVideoAudienceDescriptionList"] = null;
                }

                ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/VideoDetails.aspx','','height=580,width=600,scrollbars=1,resizable=1');", true);
            }
        }
    }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:63,代码来源:Add.aspx.cs


示例11: AddAddsToNewGroupIfGroupDoesntExist

        public void AddAddsToNewGroupIfGroupDoesntExist()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo" });

            list.Add("World", "Bar");

            list.Should().HaveCount(2);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Foo");
            list.Should().Contain(g => g.Title == "World" && g.Count == 1 && g[0] == "Bar");
        }
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:11,代码来源:ListItemCollectionTest.cs


示例12: AddAddsToExistingGroupIfGroupDoesExist

        public void AddAddsToExistingGroupIfGroupDoesExist()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo" });

            list.Add("Hello", "Bar");

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                g.Contains("Foo") && g.Contains("Bar"));
        }
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:11,代码来源:ListItemCollectionTest.cs


示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                SetDefaultButton(save);

                ListItemCollection intervals = new ListItemCollection();
                intervals.Add(new ListItem("Never", Convert.ToString(-1)));
                intervals.Add(new ListItem("Every Request", Convert.ToString(0)));
                intervals.Add(new ListItem("One Minute", Convert.ToString(60)));
                intervals.Add(new ListItem("Five Minutes", Convert.ToString(5 * 60)));
                intervals.Add(new ListItem("Ten Minutes", Convert.ToString(10 * 60)));
                intervals.Add(new ListItem("Half Hour", Convert.ToString(30 * 60)));
                intervals.Add(new ListItem("One Hour", Convert.ToString(60 * 60)));
                intervals.Add(new ListItem("Twelve Hours", Convert.ToString(12 * 60 * 60)));
                intervals.Add(new ListItem("One Day", Convert.ToString(24 * 60 * 60)));

                inputInterval.DataSource = intervals;
                inputInterval.DataBind();

                inputType.DataSource = Enum.GetValues(typeof(TransitFeedType));
                inputType.DataBind();

                if (RequestId > 0)
                {
                    inputName.Text = Feed.Name;
                    inputUrl.Text = Feed.Url;
                    inputDescription.Text = Feed.Description;
                    inputXsl.PostedFile = new UploadControl.HttpPostedFile(string.IsNullOrEmpty(Feed.Xsl) ? "None" : string.Format("{0} bytes", Feed.Xsl.Length));

                    ListItem li = inputInterval.Items.FindByValue(Feed.Interval.ToString());
                    if (li == null)
                    {
                        li = new ListItem(string.Format("{0} Seconds", Feed.Interval), Feed.Interval.ToString());
                        inputInterval.Items.Add(li);
                    }

                    inputInterval.ClearSelection();
                    li.Selected = true;

                    inputUsername.Text = Feed.Username;
                    inputPassword.Attributes["value"] = Feed.Password;

                    inputType.Items.FindByValue(Feed.Type.ToString()).Selected = true;
                }
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
开发者ID:dblock,项目名称:dblog,代码行数:54,代码来源:EditFeed.aspx.cs


示例14: MyDropDown

 ComboBoxCell MyDropDown()
 {
     var combo = new ComboBoxCell ();
     var items = new ListItemCollection ();
     items.Add (new ListItem{ Text = "Item 1" });
     items.Add (new ListItem{ Text = "Item 2" });
     items.Add (new ListItem{ Text = "Item 3" });
     items.Add (new ListItem{ Text = "Item 4" });
     combo.DataStore = items;
     return combo;
 }
开发者ID:M1C,项目名称:Eto,代码行数:11,代码来源:GridViewSection.cs


示例15: ItensParaTarefas

        public static List<Tarefa> ItensParaTarefas(ListItemCollection itensTarefas)
        {
            List<Tarefa> tarefas = new List<Tarefa>();

            foreach (ListItem item in itensTarefas)
            {
                tarefas.Add(ItemParaTarefa(item));
            }

            return tarefas;
        }
开发者ID:tiagosarri,项目名称:SharePoint-Demos,代码行数:11,代码来源:TarefaConverterHelper.cs


示例16: IncludeItems

 public SPClientView IncludeItems(ListItemCollectionPosition position = null, bool datesInUtc = false,
     string folderServerRelativeUrl = null, params Expression<Func<ListItemCollection, object>>[] retrievals)
 {
     _items = ClientList.List.GetItems(new CamlQuery
     {
         ListItemCollectionPosition = position,
         ViewXml = View.ListViewXml
     });
     View.Context.Load(_items, retrievals);
     _executeQuery = true;
     return this;
 }
开发者ID:rlocus,项目名称:SPAccess,代码行数:12,代码来源:SPClientView.cs


示例17: CheckFolderExists

 /// <summary>
 /// Function to verify if Folder already exists in Site Assets
 /// </summary>
 /// <param name="matterCenterAssetsFolder">Matter Center Assets Folder</param>
 /// <param name="clientContext">Client Context</param>
 /// <param name="siteAssets">Site Assets</param>
 /// <param name="matterLandingFolder">Matter Landing Folder</param>
 /// <param name="listFolders">List Folder</param>
 /// <returns>List of items in folder</returns>
 private static ListItemCollection CheckFolderExists(string matterCenterAssetsFolder, ClientContext clientContext, out List siteAssets, out ListItemCollection matterLandingFolder, out FolderCollection listFolders)
 {
     CamlQuery camlQuery = new CamlQuery();
     camlQuery.ViewXml = @"<View><Query><Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='Folder'>" + matterCenterAssetsFolder + "</Value></Eq></Where></Query><ViewFields><FieldRef Name='FileLeafRef' /></ViewFields></View>";
     siteAssets = clientContext.Web.Lists.GetByTitle(ConfigurationManager.AppSettings["LibraryName"]);
     matterLandingFolder = siteAssets.GetItems(camlQuery);
     listFolders = siteAssets.RootFolder.Folders;
     clientContext.Load(matterLandingFolder);
     clientContext.Load(siteAssets.RootFolder);
     clientContext.Load(listFolders);
     clientContext.ExecuteQuery();
     return matterLandingFolder;
 }
开发者ID:Microsoft,项目名称:mattercenter,代码行数:22,代码来源:UploadFile.cs


示例18: AdAll_Click

    protected void AdAll_Click(object sender, EventArgs e)
    {
        ListItemCollection liC = new ListItemCollection();

        foreach (ListItem li in AvForumsList.Items)
            {
                MdForumsList.Items.Add(li);
                li.Selected = false;
                liC.Add(li);
            }

        foreach (ListItem li in liC)
            AvForumsList.Items.Remove(li);
    }
开发者ID:huwred,项目名称:SnitzDotNet,代码行数:14,代码来源:ManageModerators.ascx.cs


示例19: listItemCollectionToStringArray

    protected static string[] listItemCollectionToStringArray(ListItemCollection items)
    {
        ArrayList arrayList = new ArrayList(items.Count);

        foreach (ListItem listItem in items)
        {
            if (listItem.Selected == true)
                arrayList.Add(listItem.Text);
        }

        arrayList.TrimToSize();

        return (string[])arrayList.ToArray(typeof(string));
    }
开发者ID:Letractively,项目名称:rpcwc,代码行数:14,代码来源:user_role.aspx.cs


示例20: RemoveSelectedFromBasket_ButtonClick

 protected void RemoveSelectedFromBasket_ButtonClick(object sender, EventArgs e)
 {
     ListItemCollection ItemsForRemoveActionInBasketListBox = new ListItemCollection();
     foreach (ListItem CurrentItem in this.ListBoxSelectedProducts.Items)
     {
         if (CurrentItem.Selected)
         {
             this.ListBoxProducts.Items.Add(CurrentItem);
             ItemsForRemoveActionInBasketListBox.Add(CurrentItem);
         }
     }
     foreach (ListItem CurrentItem in ItemsForRemoveActionInBasketListBox)
     {
         this.ListBoxSelectedProducts.Items.Remove(CurrentItem);
     }  
 }
开发者ID:Saroko-dnd,项目名称:My_DZ,代码行数:16,代码来源:Default.aspx.cs



注:本文中的ListItemCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ListItemCreationInformation类代码示例发布时间:2022-05-24
下一篇:
C# ListItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap