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


C# ListItemCollection.Add方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.ListItemCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ListItemCollection.Add方法的具体用法?C# ListItemCollection.Add怎么用?C# ListItemCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.ListItemCollection的用法示例。


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

示例1: LoadStatusList2DDL

        public void LoadStatusList2DDL(string selected_value)
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            rdlDiscontinued.DataSource = lstColl;
            rdlDiscontinued.DataTextField = "Text";
            rdlDiscontinued.DataValueField = "Value";
            rdlDiscontinued.DataBind();
            rdlDiscontinued.SelectedValue = selected_value;
         
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:13,代码来源:admin_banner_position_edit.aspx.cs

示例2: LoadControlTypeList2DDL

        protected void LoadControlTypeList2DDL()
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Tab", "1"));
            lstColl.Add(new ListItem("Module", "2"));

            ddlControlType.DataSource = lstColl;
            ddlControlType.DataTextField = "Text";
            ddlControlType.DataValueField = "Value";
            ddlControlType.DataBind();
            ddlControlType.Items.Insert(0, new ListItem("- Chọn -", "0"));
            ddlControlType.SelectedIndex = 0;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:13,代码来源:admin_module_controller_add.aspx.cs

示例3: LoadStatus2DDL

        protected void LoadStatus2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            ddlStatus.DataSource = lstColl;
            ddlStatus.DataTextField = "Text";
            ddlStatus.DataValueField = "Value";
            ddlStatus.DataBind();
            ddlStatus.AutoPostBack = true;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:13,代码来源:admin_media_types.ascx.cs

示例4: LoadDomainGroup2RadioBtnList

        public void LoadDomainGroup2RadioBtnList()
        {
            ListItemCollection lst = new ListItemCollection();
            lst.Add(new ListItem("Tên miềm phổ biến", "1"));
            lst.Add(new ListItem("Tên miềm Việt Nam", "2"));
            lst.Add(new ListItem("Tên miềm Việt Nam theo địa giới hành chính", "3"));
            lst.Add(new ListItem("Tên miềm Quốc Tế", "4"));      

            rdlDomainGroup.Items.Clear();            
            rdlDomainGroup.DataSource = lst;
            rdlDomainGroup.DataBind();
            rdlDomainGroup.SelectedIndex = 0;
            rdlDomainGroup.AutoPostBack = true;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:14,代码来源:checkdomain.ascx.cs

示例5: LoadDiscontinued2DDL

        protected void LoadDiscontinued2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Hiện", "1"));
            lstColl.Add(new ListItem("Ẩn", "0"));

            ddlDiscontinued.DataSource = lstColl;
            ddlDiscontinued.DataTextField = "Text";
            ddlDiscontinued.DataValueField = "Value";
            ddlDiscontinued.DataBind();
            ddlDiscontinued.SelectedIndex = 0; // Select the first item
            ddlDiscontinued.AutoPostBack = true;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:14,代码来源:admin_languages.ascx.cs

示例6: LoadStatus2RadioBtnList

        protected void LoadStatus2RadioBtnList(string selected_value)
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Published", "2"));
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            rdlStatus.DataSource = lstColl;
            rdlStatus.DataTextField = "Text";
            rdlStatus.DataValueField = "Value";
            rdlStatus.DataBind();
            rdlStatus.SelectedValue = selected_value;
            rdlStatus.AutoPostBack = false;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:15,代码来源:admin_article_comments_edit.aspx.cs

示例7: LoadStatus2DDL

        protected void LoadStatus2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            ddlStatus.DataSource = lstColl;
            ddlStatus.DataTextField = "Text";
            ddlStatus.DataValueField = "Value";
            ddlStatus.DataBind();
            ddlStatus.Items.Insert(0, new ListItem("Chọn trạng thái", "")); // add the new item at the top of the list
            ddlStatus.SelectedIndex = 1; // Select the first item
            ddlStatus.AutoPostBack = true;
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:15,代码来源:admin_media_topics.ascx.cs

示例8: Page_Load

          protected void Page_Load(object sender, EventArgs e)
          {
              if (!IsPostBack)
              {

                  DataSet ds = objTransferPackageTimings.GetAllTrasferpackageDescription(int.Parse(Request.QueryString["ID"].ToString()));
                  GridView1.DataSource = ds;
                  GridView1.DataBind();


                  foreach (GridViewRow item in GridView1.Rows)
                  {
                      Label lblfromTOid = (Label)item.FindControl("lbltp_detialid");
                      Label lblFlag = (Label)item.FindControl("lblFlag");
                      DDL1 = (MulticheckDropdown)item.FindControl("DDL1");
                      DataSet ds1 = objTransferPackageTimings.GetAallTimings();

                      //DataSet DsMealDate = objHotelStoreProcedure.getALLdateFORmEAL(txtpty_CheckIn.Text, txtpty_CheckOut.Text);
                      ListItemCollection list = new ListItemCollection();
                      for (int i1 = 0; i1 < ds1.Tables[0].Rows.Count; i1++)
                      {
                          ListItem listitem = new ListItem(Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"]), Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"]));
                          list.Add(listitem);

                      }
                      DDC1.DDList.DataSource = list;
                      DDC1.DDList.DataTextField = "Text";
                      DDC1.DDList.DataValueField = "Value";
                      DDC1.DDList.DataBind();


                      DataSet ds11 = objTransferPackageTimings.GetAllTrasferpackageTimmings(int.Parse(lblfromTOid.Text), lblFlag.Text, "SIC");

                      if (ds11.Tables[0].Rows.Count != 0)
                      {

                          ListItemCollection list2 = new ListItemCollection();
                          for (int j = 0; j < ds11.Tables[0].Rows.Count; j++)
                          {
                              for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                              {
                                  if (ds1.Tables[0].Rows[i]["TIME"].ToString() == ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString())
                                  {
                                      setchk = setchk + "," + Convert.ToString(ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString());
                                  }

                              }

                          }

                          setchk = setchk.Substring(1);
                          DDC1.SetCheckBoxValues(setchk);
                          setchk = "";
                      }

                  }

              }

          }
开发者ID:pareshf,项目名称:testthailand,代码行数:60,代码来源:TransferPackageTimingMaster.aspx.cs

示例9: GetListItemsFromEnum

 private ListItemCollection GetListItemsFromEnum(int languageId, Type enumType)
 {
     // container to be returned
     ListItemCollection items = new ListItemCollection();
     // break down the enumerator items into key/value pairs
     string[] names = Enum.GetNames(enumType);
     Array values = Enum.GetValues(enumType);
     // piece together the key/pairs into the listitem collection
     items.Add(new ListItem("Please select", ""));
     for (int i = 1; i <= names.Length - 1; i++)
     {
         items.Add(new ListItem(TranslateApplicationString(languageId, names[i]), i.ToString()));
     }
     // return it
     return items;
 }
开发者ID:GramozKrasniqi,项目名称:HRMS,代码行数:16,代码来源:TranslatedPage.cs

示例10: BuildListFromEnum

        public static ListItemCollection BuildListFromEnum(Enum objEnum)
        {
            ListItemCollection colListItems = new ListItemCollection();
            ListItem liItem;

            SortedList colSortedListItems = new SortedList();

            foreach (int value in Enum.GetValues(objEnum.GetType()))
            {
                liItem = new ListItem();

                liItem.Value = value.ToString();
                liItem.Text = StringEnum.GetStringValue((Enum)Enum.Parse(objEnum.GetType(), value.ToString(), true));

                if (liItem.Text != string.Empty)
                {
                    colSortedListItems.Add(liItem.Text, liItem);
                }
                liItem = null;
            }

            foreach (ListItem liListItem in colSortedListItems.GetValueList())
            {
                colListItems.Add(liListItem);
            }

            return colListItems;
        }
开发者ID:IntertechInc,项目名称:.net-utilities,代码行数:28,代码来源:ListItemHelper.cs

示例11: BindLotteryMaintenanceNavigation

        private void BindLotteryMaintenanceNavigation()
        {
            //notes:    set up collection of list items
            ListItemCollection navigationList = new ListItemCollection();

            //notes:    set local variables and set default values
            bool isLotteryLookupLinkable = true;

            string lotteryLookupQueryString = string.Empty;

            switch (this.CurrentNavigationLink)
            {
                case LotteryMaintenanceNavigation.LotteryLookup:
                    isLotteryLookupLinkable = false;
                    break;

            }

            //notes:    add each item to the collection
            navigationList.Add(new ListItem { Text = "Lottery Game Lookup", Value = "/LotteryMaintenance/Default/aspx", Enabled = isLotteryLookupLinkable });

            //notes:    bind list object to front-end control
            LotteryMaintenanceNavigationList.DataSource = navigationList;
            LotteryMaintenanceNavigationList.DataBind();
        }
开发者ID:bllr777,项目名称:CheckWork,代码行数:25,代码来源:LotteryMaintenanceNavigationControl.ascx.cs

示例12: BindListItem

 public static void BindListItem(ListItemCollection LIC, DataView DataSource, string TextField, string ValueField)
 {
     LIC.Clear();
     for (int i = 0; i < DataSource.Count; i++)
     {
         LIC.Add(new ListItem(DataSource[i][TextField].ToString(), DataSource[i][ValueField].ToString()));
     }
 }
开发者ID:kingofhawks,项目名称:kcsj,代码行数:8,代码来源:CommonFunc.cs

示例13: BindLotteryNavigation

        public void BindLotteryNavigation()
        {
            // Instantiates new list item collection
            ListItemCollection navigationList = new ListItemCollection();

            // sets variables and sets their default values
            bool isGame = true;
            bool isWinningNumbers = true;
            bool isPrizeOddsOfWinning = true;
            string gameIdQueryString = "GameId=" + this.GameId.ToString();

            //Switch case for deactivating the hyperlinks
            if (this.GameId > 0)
            {
                switch (this.CurrentNavigationLink)
                {
                    case LotteryNavigation.Game:
                        isGame = false;
                        break;
                    case LotteryNavigation.WinningNumbers:
                        isWinningNumbers = false;
                        break;
                    case LotteryNavigation.Prizes:
                        isPrizeOddsOfWinning = false;
                        break;
                }
            }
            else
            {
                //If no employee id exists set all links to inactive
                isGame = false;
                isWinningNumbers = false;
                isPrizeOddsOfWinning = false;
            }

            // add each item to the collection
            navigationList.Add(new ListItem { Text = "Game", Value = "/GameSection/Game.aspx?" + gameIdQueryString, Enabled = isGame });
            navigationList.Add(new ListItem { Text = "Winning Numbers", Value = "/GameSection/WinningNumbers.aspx?" + gameIdQueryString, Enabled = isWinningNumbers });
            navigationList.Add(new ListItem { Text = "Prizes", Value = "/GameSection/Prizes.aspx?" + gameIdQueryString, Enabled = isPrizeOddsOfWinning });

            // bind list objects to front-end control
            LotteryNavigationList.DataSource = navigationList;
            LotteryNavigationList.DataBind();
        }
开发者ID:jwp8807,项目名称:LotteryAppCorrectOne,代码行数:44,代码来源:LotteryNavigationControl.ascx.cs

示例14: BindTableMaintenanceNavigation

        private void BindTableMaintenanceNavigation()
        {
            ListItemCollection navigationList = new ListItemCollection();

            bool isEntityLookUpLinkable = true;
            bool isClientLookupLinkable = true;
            bool isVehicleMakeModelLinkable = true;
            bool isVehicleLinkable = true;

            string entityLookupQueryString = string.Empty;
            string vehicleMakeModelQueryString = string.Empty;

            switch( this.CurrentNavigationLink)
            {

                case TableMaintenanceNavigation.EntityLookup:
                    isEntityLookUpLinkable = false;
                    break;

                case TableMaintenanceNavigation.Client:
                    isClientLookupLinkable = false;
                    break;

                case TableMaintenanceNavigation.VehicleMakeModel:
                    isVehicleMakeModelLinkable = false;
                    break;

                case TableMaintenanceNavigation.Vehicle:
                    isVehicleLinkable = false;
                    break;
            }

            navigationList.Add(new ListItem { Text = "Entity Type Lookup", Value = "/TableMaintenance/Default.aspx", Enabled = isEntityLookUpLinkable });
            navigationList.Add(new ListItem { Text = "Client Info", Value = "/TableMaintenance/Client.aspx", Enabled = isClientLookupLinkable});
            navigationList.Add(new ListItem { Text = "Vehicle Make & Model", Value = "/TableMaintenance/VehicleMakeModel.aspx", Enabled = isVehicleMakeModelLinkable });
            navigationList.Add(new ListItem { Text = "Aston Vehicles", Value = "/TableMaintenance/Vehicles.aspx", Enabled = isVehicleLinkable});

            TableMaintenanceNavigationList.DataSource = navigationList;
            TableMaintenanceNavigationList.DataBind();
        
        }
开发者ID:justyBig,项目名称:OGAstonEngineer,代码行数:41,代码来源:TableMaintenanceNavigationControl.ascx.cs

示例15: DataBindSearchTermTagList

 //绑定学期标识下拉列表
 public void DataBindSearchTermTagList(ListItemCollection itemCollection)
 {
     DalOperationAboutCourses doac = new DalOperationAboutCourses();
     DataTable dt = doac.FindAllTermTags().Tables[0];
     string termTag = null;
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         termTag = dt.Rows[i]["termTag"].ToString().Trim();
         ListItem li = new ListItem(CommonUtility.ChangeTermToString(termTag), termTag);
         itemCollection.Add(li);
     }
 }
开发者ID:skyaspnet,项目名称:usta,代码行数:13,代码来源:AddTeacherSalary.aspx.cs


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