當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。