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


C# WebControls.ListItemCollection類代碼示例

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


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

示例1: 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

示例2: RenderBulletText

 // Writes the text of each bullet according to the list's display mode.
 protected virtual void RenderBulletText (ListItemCollection items, int index, HtmlTextWriter writer) {
     switch (Control.DisplayMode) {
         case BulletedListDisplayMode.Text:
             writer.WriteEncodedText(items[index].Text);
             writer.WriteBreak();
             break;
         case BulletedListDisplayMode.HyperLink:
             // 
             string targetURL = Control.ResolveClientUrl(items[index].Value);
             if (items[index].Enabled) {
                 PageAdapter.RenderBeginHyperlink(writer, targetURL, true /* encode */, items[index].Text);
                 writer.Write(items[index].Text);
                 PageAdapter.RenderEndHyperlink(writer);
             } else {
                 writer.WriteEncodedText(items[index].Text);
             }
             writer.WriteBreak();
             break;
         case BulletedListDisplayMode.LinkButton:
             if (items[index].Enabled) {
                 // 
                 PageAdapter.RenderPostBackEvent(writer, Control.UniqueID, index.ToString(CultureInfo.InvariantCulture),
                                                     items[index].Text, items[index].Text);
             } else {
                 writer.WriteEncodedText(items[index].Text);
             }
             writer.WriteBreak();
             break;
         default:
             Debug.Assert(false, "Invalid BulletedListDisplayMode");
             break;
     }
 }
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:34,代碼來源:WmlBulletedListAdapter.cs

示例3: 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.ConfigurationManager.AppSettings["ConnectionString"],
                        "spAddTradeItem",
                        TradeId,
                        TeamId,
                        PickId,
                        PlayerId
                    );
                }
            }
        }
開發者ID:ohri,項目名稱:netba,代碼行數:29,代碼來源:TradePropose.aspx.cs

示例4: 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

示例5: SelectSingleListItem

		public static void SelectSingleListItem(ListItemCollection items, string val)
		{
			foreach(ListItem itm in items)
				if(itm.Value == val)
						itm.Selected = true;
				else	itm.Selected = false;
		}
開發者ID:jmptrader,項目名稱:docflow-aspnet,代碼行數:7,代碼來源:WebUtils.cs

示例6: 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

示例7: ExtendedListItemCollection

 /// <summary>
 /// Initializes a new instance of the <see cref="ExtendedListItemCollection"/> class.
 /// </summary>
 /// <param name="wrappedCollection">The wrapped collection.</param>
 public ExtendedListItemCollection(ListItemCollection wrappedCollection)
 {
     if (null == wrappedCollection)
     {
         throw new ArgumentNullException("wrappedCollection");
     }
     this._wrappedCollection = wrappedCollection;
 }
開發者ID:fmendes,項目名稱:RegisterJavascript,代碼行數:12,代碼來源:ExtendedListItemCollection.cs

示例8: 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

示例9: AtribucionesUsuario

        public AtribucionesUsuario(string usuario,string TipoUsuario,string UserId)
        {
            this.usuario = usuario;
            this.tipoUsuario = TipoUsuario;
            this.userId = UserId;

            propiedades = new ListItemCollection();
        }
開發者ID:royriojas,項目名稱:RGEN2,代碼行數:8,代碼來源:AtribucionesUsuario.cs

示例10: BindingPages

 private void BindingPages()
 {
     var pages = db.Pages.Where(t => t.ParentId == -1).ToList();
     ListItemCollection list = new ListItemCollection();
     GetListPages(pages, ref list, 0);
     ddlPages.DataSource = list;
     ddlPages.DataTextField = "Text";
     ddlPages.DataValueField = "Value";
     ddlPages.DataBind();
     ddlPages.Items.Insert(0, new ListItem("-None-", "-1"));
 }
開發者ID:valendo,項目名稱:MyCMS,代碼行數:11,代碼來源:Setting.aspx.cs

示例11: 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

示例12: GetFontFamilies

 public static ListItemCollection GetFontFamilies()
 {
     var col = new ListItemCollection
                   {
                       new ListItem("Arial", "Arial"),
                       new ListItem("Verdana", "Verdana"),
                       new ListItem("Lucida Sans", "Lucida Sans"),
                       new ListItem("Calibri", "Calibri"),
                       new ListItem("Trebuchet MS", "Trebuchet MS")
                   };
     return col;
 }
開發者ID:Learion,項目名稱:BruceToolSet,代碼行數:12,代碼來源:FontsSettingsODS.cs

示例13: BindLotteryNavigation

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

            bool isBasicInfo = true;
            bool isDrawing = true;
            bool isWinningNumber = true;
            bool isState = true;
            bool isWin = true;
            string lotteryIdQueryString = "LotteryId=" + this.LotteryGameId.ToString();

            if (this.LotteryGameId > 0)
            {
                switch (this.CurrentNavigationLink)
                {
                    case LotteryNavigation.LotteryBasic:
                        isBasicInfo = false;
                        break;
                    case LotteryNavigation.Drawing:
                        isDrawing = false;
                        break;
                    case LotteryNavigation.WinningNumber:
                        isWinningNumber = false;
                        break;
                    case LotteryNavigation.State:
                        isState = false;
                        break;
                    case LotteryNavigation.Win:
                        isWin = false;
                        break;
                }
            }

            else
            {
                isBasicInfo = false;
                isDrawing = false;
                isWinningNumber = false;
                isState = false;
                isWin = false;
            }

            navigationList.Add(new ListItem { Text = "Basic Info", Value ="/LotterySection/LotteryBasic.aspx?" + lotteryIdQueryString, Enabled = isBasicInfo });
            navigationList.Add(new ListItem { Text = "Drawing", Value = "/LotterySection/Drawing.aspx?" + lotteryIdQueryString, Enabled = isDrawing });
            navigationList.Add(new ListItem { Text = "Winning Numbers", Value = "/LotterySection/WinningNumber.aspx?" + lotteryIdQueryString, Enabled = isWinningNumber });
            navigationList.Add(new ListItem { Text = "State", Value = "/LotterySection/State.aspx?" + lotteryIdQueryString, Enabled = isState });

            navigationList.Add(new ListItem { Text = "Win", Value = "/LotterySection/Win.aspx?" + lotteryIdQueryString, Enabled = isWin });

            LotteryNavigationList.DataSource = navigationList;
            LotteryNavigationList.DataBind();
        }
開發者ID:bllr777,項目名稱:CheckWork,代碼行數:52,代碼來源:LotteryNavigationControl.ascx.cs

示例14: 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

示例15: SelectListBoxItems

		private void SelectListBoxItems(ListItemCollection listItems, string req)
		{
			if(req == null || req.Length == 0)
				return;
			string items_string = "," + req + ",";
			
			foreach(ListItem itm in listItems)
			{
				if(items_string.IndexOf("," + itm.Value + ",") != -1)
						itm.Selected = true;
				else	itm.Selected = false;
			}
		}
開發者ID:jmptrader,項目名稱:docflow-aspnet,代碼行數:13,代碼來源:SearchForm.aspx.cs


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