当前位置: 首页>>代码示例>>C#>>正文


C# ListItemCollection类代码示例

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


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


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