本文整理汇总了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 = "";
}
}
}
}
示例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;
}
}
示例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
);
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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()));
}
}
示例9: AtribucionesUsuario
public AtribucionesUsuario(string usuario,string TipoUsuario,string UserId)
{
this.usuario = usuario;
this.tipoUsuario = TipoUsuario;
this.userId = UserId;
propiedades = new ListItemCollection();
}
示例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"));
}
示例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);
}
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
}