本文整理汇总了C#中ListItem类的典型用法代码示例。如果您正苦于以下问题:C# ListItem类的具体用法?C# ListItem怎么用?C# ListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListItem类属于命名空间,在下文中一共展示了ListItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetProperties
protected override void SetProperties(ListItem item)
{
BaseSet(item, FIELD_FIRSTNAME, SpeakerFirstName);
BaseSet(item, FIELD_LASTNAME, SpeakerLastName);
BaseSet(item, FIELD_EMAIL, SpeakerEmail);
BaseSet(item, FIELD_ID, SpeakerId);
}
开发者ID:Calisto1980,项目名称:PnP,代码行数:7,代码来源:Speaker.cs
示例2: MapProperties
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
{
base.MapProperties(modelHost, item, definition);
var typedDefinition = definition.WithAssertAndCast<FilterDisplayTemplateDefinition>("model", value => value.RequireNotNull());
item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660400F643FF79F6BD764F8A469B6F153396EE";
if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileURL))
{
var crawlerXSLFileValue = new FieldUrlValue { Url = typedDefinition.CrawlerXSLFileURL };
if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileDescription))
crawlerXSLFileValue.Description = typedDefinition.CrawlerXSLFileDescription;
item["CrawlerXSLFile"] = crawlerXSLFileValue;
}
if (!string.IsNullOrEmpty(typedDefinition.CompatibleManagedProperties))
item["CompatibleManagedProperties"] = typedDefinition.CompatibleManagedProperties;
if (typedDefinition.CompatibleSearchDataTypes.Count > 0)
{
item["CompatibleSearchDataTypes"] = typedDefinition.CompatibleSearchDataTypes.ToArray();
}
}
开发者ID:karayakar,项目名称:spmeta2,代码行数:27,代码来源:FilterDisplayTemplateModelHandler.cs
示例3: getfiles
public void getfiles(string dir)
{
ddFilesMovie.Items.Clear();
ListItem li1 = new ListItem();
li1.Text = "-- select --";
li1.Value = "-1";
ddFilesMovie.Items.Add(li1);
ArrayList af = new ArrayList();
string[] Filesmovie = Directory.GetFiles(dir);
foreach (string file in Filesmovie)
{
string appdir = Server.MapPath("~/App_Uploads_Img/") + ddCatMovie.SelectedValue;
string filename = file.Substring(appdir.Length + 1);
if ((!filename.Contains("_svn")) && (!filename.Contains(".svn")))
{
if (filename.ToLower().Contains(".mov") || filename.ToLower().Contains(".flv") || filename.ToLower().Contains(".wmv") )
{
ListItem li = new ListItem();
li.Text = filename;
li.Value = filename;
ddFilesMovie.Items.Add(li);
}
}
}
UpdatePanel1Movie.Update();
}
开发者ID:wpdildine,项目名称:wwwroot,代码行数:30,代码来源:cmsSelectMovieControl.ascx.cs
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
this.cadenaconexion =
"Data Source=LOCALHOST;Initial Catalog=HOSPITAL;User ID=SA";
this.cn = new SqlConnection(this.cadenaconexion);
this.com = new SqlCommand();
//LA PRIMERA VEZ...
if (this.Page.IsPostBack == false)
{
this.lstdepartamentos.AutoPostBack = true;
this.com.Connection = this.cn;
this.com.CommandType = System.Data.CommandType.Text;
this.com.CommandText = "SELECT * FROM DEPT";
this.cn.Open();
this.lector = this.com.ExecuteReader();
while (this.lector.Read())
{
ListItem it = new ListItem();
it.Text = this.lector["DNOMBRE"].ToString();
it.Value = this.lector["DEPT_NO"].ToString();
this.lstdepartamentos.Items.Add(it);
}
this.lector.Close();
this.cn.Close();
}
}
开发者ID:Randy-ak47,项目名称:CursoPooNet,代码行数:27,代码来源:Web04ListaDepartamentos.aspx.cs
示例5: MapProperties
protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
{
base.MapProperties(modelHost, item, definition);
var typedDefinition = definition.WithAssertAndCast<JavaScriptDisplayTemplateDefinition>("model", value => value.RequireNotNull());
item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F3851068";
if (!string.IsNullOrEmpty(typedDefinition.Standalone))
item["DisplayTemplateJSTemplateType"] = typedDefinition.Standalone;
if (!string.IsNullOrEmpty(typedDefinition.TargetControlType))
item["DisplayTemplateJSTargetControlType"] = typedDefinition.TargetControlType;
if (!string.IsNullOrEmpty(typedDefinition.TargetListTemplateId))
item["DisplayTemplateJSTargetListTemplate"] = typedDefinition.TargetListTemplateId;
if (!string.IsNullOrEmpty(typedDefinition.TargetScope))
item["DisplayTemplateJSTargetScope"] = typedDefinition.TargetScope;
if (!string.IsNullOrEmpty(typedDefinition.IconUrl))
{
var iconValue = new FieldUrlValue { Url = typedDefinition.IconUrl };
if (!string.IsNullOrEmpty(typedDefinition.IconDescription))
iconValue.Description = typedDefinition.IconDescription;
item["DisplayTemplateJSIconUrl"] = iconValue;
}
}
开发者ID:Uolifry,项目名称:spmeta2,代码行数:30,代码来源:JavaScriptDisplayTemplateModelHandler.cs
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
if (this.Session["admin"] == null)
{
base.Response.Redirect("/account/Login.aspx");
}
if (GeneralMethods.GetPermissions(HttpContext.Current.Request.Url.ToString(), this.Session["admin"].ToString()))
{
base.Response.Redirect("/Index.aspx");
}
Model.SelectRecord selectRecord = new Model.SelectRecord("Role", "", "*", "where isState=1 order by id desc");
DataTable table = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0];
if (table.Rows.Count > 0)
{
for (int i = 0; i < table.Rows.Count; i++)
{
ListItem li=new ListItem(table.Rows[i][1].ToString(),table.Rows[i][0].ToString());
this.selIsState.Items.Add(li);
if (i == 0)
{
this.selIsState.SelectedValue = table.Rows[0][0].ToString();
}
}
}
BLL.Organizational.BindToListBox(List_Organ, "");
}
}
开发者ID:rensy,项目名称:DocumentManage,代码行数:29,代码来源:AddUser.aspx.cs
示例7: FillDropDownList
protected void FillDropDownList()
{
//从web.config中获取数据库连接
string connectionStr = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
//创建与数据库的连接
using (SqlConnection conn = new SqlConnection(connectionStr))
{
conn.Open();
//新建一个SqlCommand对象
SqlCommand cmd = new SqlCommand("Select * from Customers", conn);
//创建一个SqlDataReader对象
SqlDataReader sdr = cmd.ExecuteReader();
//一次一行读取SqlDataReader对象并添加到DropDownList中去。
while (sdr.Read())
{
ListItem newItem = new ListItem();
newItem.Text = sdr["CompanyName"] as string;
newItem.Value = sdr["CustomerID"].ToString();
DropDownList1.Items.Add(newItem);
}
//使用完毕记得关毕SqlDataReader对象
sdr.Close();
}
}
开发者ID:AJLoveChina,项目名称:workAtQmm,代码行数:25,代码来源:DatareaderDemo.aspx.cs
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
// renk
string[] colorArray = Enum.GetNames(typeof(System.Drawing.KnownColor));
lstBackColor.DataSource = colorArray;
lstBackColor.DataBind();
// font
System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
foreach (FontFamily family in fonts.Families)
{
lstFontName.Items.Add(family.Name);
}
ListItem item = new ListItem();
string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
lstBorder.DataSource = borderStyleArray;
lstBorder.DataBind();
lstBorder.SelectedIndex = 0;
imgDefault.ImageUrl = "images/default-user-image.png";
imgDefault.Visible = false;
}
}
开发者ID:madmed,项目名称:netron,代码行数:27,代码来源:Default.aspx.cs
示例9: CreateCheckBoxListGroup
private void CreateCheckBoxListGroup()
{
if (DataGridUser.EditItemIndex != -1)
{
CheckBoxList groupList = DataGridUser.Items[DataGridUser.EditItemIndex].Cells[6].FindControl("CheckBoxListGroup") as CheckBoxList;
FSEye.Security.User user = TheAdminServer.SecurityManager.GetUser((int)Store.Rows[DataGridUser.EditItemIndex].ItemArray[0]);
if (groupList != null)
{
Group[] groups = TheAdminServer.SecurityManager.GetAllGroups();
if (groups != null && groups.Length != 0)
foreach (Group group in groups)
{
ListItem item = new ListItem(group.SecurityObject.Name, group.SecurityObject.Id.ToString());
if(user!=null)
{
foreach (int groupId in user.Groups)
{
if (groupId == group.SecurityObject.Id) item.Selected = true;
}
}
groupList.Items.Add(item);
}
}
}
}
开发者ID:viticm,项目名称:pap2,代码行数:26,代码来源:ListUser.aspx.cs
示例10: BindSite
protected void BindSite()
{
colSite = objSite.Get_All();
for (int i = 0; i < colSite.Count; i++)
{
for (int j = i; j < colSite.Count; j++)
{
if (String.Compare(colSite[i].Sitename, colSite[j].Sitename) > 0)
{
Site_mst obj = new Site_mst();
obj = colSite[i];
colSite[i] = colSite[j];
colSite[j] = obj;
}
}
}
drpsite.DataTextField = "sitename";
drpsite.DataValueField = "siteid";
drpsite.DataSource = colSite;
drpsite.DataBind();
ListItem item = new ListItem();
item.Text = "All";
item.Value = "0";
drpsite.Items.Add(item);
//item.Text = "---Select Site---";
//item.Value = "0";
//drpsite.Items.Add(item);
drpsite.SelectedValue = "0";
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:32,代码来源:PendingCallReport.aspx.cs
示例11: SetTaxonomyField
/// <summary>
/// Helper Method to set a Taxonomy Field on a list item
/// </summary>
/// <param name="ctx">The Authenticated ClientContext</param>
/// <param name="listItem">The listitem to modify</param>
/// <param name="model">Domain Object of key/value pairs of the taxonomy field & value</param>
public static void SetTaxonomyField(ClientContext ctx, ListItem listItem, Hashtable model)
{
FieldCollection _fields = listItem.ParentList.Fields;
ctx.Load(_fields);
ctx.ExecuteQuery();
foreach(var _key in model.Keys)
{
var _termName = model[_key].ToString();
TaxonomyField _field = ctx.CastTo<TaxonomyField>(_fields.GetByInternalNameOrTitle(_key.ToString()));
ctx.Load(_field);
ctx.ExecuteQuery();
Guid _id = _field.TermSetId;
string _termID = AutoTaggingHelper.GetTermIdByName(ctx, _termName, _id );
var _termValue = new TaxonomyFieldValue()
{
Label = _termName,
TermGuid = _termID,
WssId = -1
};
_field.SetFieldValueByValue(listItem, _termValue);
listItem.Update();
ctx.ExecuteQuery();
}
}
开发者ID:NicolajLarsen,项目名称:PnP,代码行数:33,代码来源:AutoTaggingHelper.cs
示例12: btnGonder_Click
protected void btnGonder_Click(object sender, EventArgs e)
{
int i;
pnlPanel.Height = Unit.Percentage(75);
pnlPanel.Width = Unit.Pixel(200);
lblAd.BorderStyle = BorderStyle.Dotted;
lblAd.BackColor = Color.LawnGreen;
lblAd.BorderColor = Color.FromArgb(255, 255, 0, 0);
txtAD.ForeColor = ColorTranslator.FromHtml("#00ff00");
ListItem Li=new ListItem("nolsun","denemeeee");
chklCheckDeneme.Items.Add( Li);
///*****************************************************
///
tbl.Controls.Clear();
tbl.BorderStyle = BorderStyle.Double;
tbl.BorderWidth = Unit.Pixel(1);
int rows = 3, cols = 4;
TableCell tc;
for (int sat = 0; sat < rows; sat++)
{
TableRow tr = new TableRow();
tbl.Controls.Add(tr);
for (int sut = 0; sut < cols; sut++)
{
tc = new TableCell();
tc.BorderStyle = BorderStyle.Double;
tc.BorderWidth = Unit.Pixel(1);
tc.Text = sat.ToString() + " " + sut.ToString();
tr.Controls.Add(tc);
}
}
}
开发者ID:madmed,项目名称:netron,代码行数:35,代码来源:Default.aspx.cs
示例13: LoadJobType
public void LoadJobType()
{
DataAccess dataaccess = new DataAccess();
using (SqlConnection Sqlcon = dataaccess.OpenConnection())
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = Sqlcon;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetJobType";
cmd.Parameters.Add(new SqlParameter("@Action", SqlDbType.VarChar, 50));
cmd.Parameters["@Action"].Value = "select";
cmd.Parameters.Add("@Exists", SqlDbType.Int).Direction = ParameterDirection.Output;
SqlAda = new SqlDataAdapter(cmd);
ds = new DataSet();
SqlAda.Fill(ds);
ddlJobType.DataSource = ds;
ddlJobType.DataTextField = "JobTypeName";
ddlJobType.DataValueField = "JobTypeId";
ddlJobType.DataBind();
if (ddlJobType.Items.Count >= 1)
{
ListItem lstitem = new ListItem();
lstitem.Text = "[Select]";
lstitem.Value = "0";
ddlJobType.Items.Insert(0, lstitem);
}
}
}
}
开发者ID:riteshdamedhar,项目名称:DevgiriRepo,代码行数:32,代码来源:postjob.aspx.cs
示例14: ReadProperties
protected override void ReadProperties(ListItem item)
{
SpeakerId = BaseGet<string>(item, FIELD_ID);
SpeakerFirstName = BaseGet<string>(item, FIELD_FIRSTNAME);
SpeakerLastName = BaseGet<string>(item, FIELD_LASTNAME);
SpeakerEmail = BaseGet<string>(item, FIELD_EMAIL);
}
开发者ID:Calisto1980,项目名称:PnP,代码行数:7,代码来源:Speaker.cs
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
this.Page.Title = "问答题管理";
if (!IsPostBack)
{
if (Session["userID"] == null)
{
Response.Redirect("Login.aspx");
}
else
{
string userId = Session["userID"].ToString();
string userName = userService.GetUserName(userId);
Label i1 = (Label)Page.Master.FindControl("labUser");
i1.Text = userName;
//展示绑定的数据并将它展示在下拉列表中
ddlCourse.Items.Clear();
Course course = new Course();
Course[] list = singleSelectedService.ListCourse();
for (int i = 0; i < list.Length; i++)
{
ListItem item = new ListItem(list[i].DepartmentName.ToString(), list[i].DepartmentId.ToString());
ddlCourse.Items.Add(item);
}
string selectvalue = this.ddlCourse.SelectedValue;
this.GridView1.DataSource = questionProblemService.GetQuestionProblem(selectvalue);
this.GridView1.DataBind();
}
}
}
开发者ID:kaiss78,项目名称:onlinetrainingandexam,代码行数:33,代码来源:QuestionManage.aspx.cs
示例16: Add
protected void Add()
{
if (!this.Disabled)
{
string viewStateString = base.GetViewStateString("ID");
TreeviewEx ex = this.FindControl(viewStateString + "_all") as TreeviewEx;
Assert.IsNotNull(ex, typeof(DataTreeview));
Listbox listbox = this.FindControl(viewStateString + "_selected") as Listbox;
Assert.IsNotNull(listbox, typeof(Listbox));
Item selectionItem = ex.GetSelectionItem();
if (selectionItem == null)
{
SheerResponse.Alert("Select an item in the Content Tree.", new string[0]);
}
else if (!this.HasExcludeTemplateForSelection(selectionItem))
{
if (this.IsDeniedMultipleSelection(selectionItem, listbox))
{
SheerResponse.Alert("You cannot select the same item twice.", new string[0]);
}
else if (this.HasIncludeTemplateForSelection(selectionItem))
{
SheerResponse.Eval("scForm.browser.getControl('" + viewStateString + "_selected').selectedIndex=-1");
ListItem control = new ListItem();
control.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("L");
Sitecore.Context.ClientPage.AddControl(listbox, control);
control.Header = selectionItem.DisplayName;
control.Value = control.ID + "|" + selectionItem.ID;
SheerResponse.Refresh(listbox);
SetModified();
}
}
}
}
开发者ID:OptimizedQuery,项目名称:Sitecore.MultiRootTreelist,代码行数:34,代码来源:MultiRootTreeList.cs
示例17: CreateCheckBoxListRoleType
private void CreateCheckBoxListRoleType()
{
ListItem item = new ListItem(string.Format("{0}[{1}]", StringDef.Jiashi, StringDef.ProfessionalNotChoose), "0,-1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Jiashi, StringDef.XuanFeng), "0,0");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Jiashi, StringDef.XingTian), "0,1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Daoshi, StringDef.ProfessionalNotChoose), "1,-1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Daoshi, StringDef.ZhenRen), "1,0");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Daoshi, StringDef.TianShi), "1,1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Yiren, StringDef.ProfessionalNotChoose), "2,-1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Yiren, StringDef.ShouShi), "2,0");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
item = new ListItem(string.Format("{0}[{1}]", StringDef.Yiren, StringDef.YiShi), "2,1");
item.Selected = true;
CheckBoxListRoleType.Items.Add(item);
}
开发者ID:viticm,项目名称:pap2,代码行数:30,代码来源:PlayerWho.aspx.cs
示例18: OnMenuChanged
public void OnMenuChanged(object sender, EventArgs e)
{
using (DBDataContext db = new DBDataContext())
{
var menudata = from LM in db.LeftMenu
orderby LM.Order
select LM;
int i;
if (int.TryParse(ddlMenu.SelectedValue, out i))
{
cblSubmenu.Items.Clear();
foreach (var sd in menudata)
{
if (sd.id != i && (sd.ParetnId == i || sd.ParetnId == null))
{
ListItem l = new ListItem();
l.Selected = sd.ParetnId == i;
l.Text = sd.ItemName;
l.Value = sd.id.ToString();
cblSubmenu.Items.Add(l);
}
}
}
}
}
开发者ID:Tigrifer,项目名称:KemConsult,代码行数:25,代码来源:LeftMenuHierarchy.aspx.cs
示例19: FillYearDropDown
/// <summary>
/// Fill year drop down with the avaliable news year
/// </summary>
private void FillYearDropDown()
{
var allNewsArticles = SiteDataManager.GetLatestNews();
if (allNewsArticles != null && allNewsArticles.Any())
{
var yearList = allNewsArticles.Select(x => x.SmartForm.Date.Year).Distinct().ToList();
if(yearList != null && yearList.Any())
{
int currentYear = DateTime.Now.Year;
lblYearSelected.Text = currentYear.ToString();
ListItem item = null;
//initial item
item = new ListItem("-Select a year-", "");
ddlArchiveYear.Items.Add(item);
foreach(var y in yearList)
{
item = new ListItem(y.ToString(), y.ToString());
if (y == currentYear)
item.Selected = true;
ddlArchiveYear.Items.Add(item);
}
}
}
}
开发者ID:femiosinowo,项目名称:sssadl,代码行数:29,代码来源:NewsListOld.aspx.cs
示例20: btnAddAnswer_Click
/// <summary>
/// Method to add Answers to the answer list box. This button will also work
/// in combination with the edit button to resubmit and edited answer.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAddAnswer_Click(object sender, EventArgs e)
{
ansEditIndex = Convert.ToInt32(Session["ansEditIndex"]);
// regular expression to enure only numbers are entered in the rank text field.
Regex reg = new Regex(@"^[-10123456789]+$");
if (tbAnswer.Text.Equals(string.Empty) || tbScore.Text.Equals(string.Empty) || (!reg.IsMatch(tbScore.Text))) {
lblErrorAdd.Visible = true;
}
else {
lblErrorAdd.Visible = false;
//
if (tbQuestion.Enabled == false) {
lbAnswerList.Items[ansEditIndex].Text = tbAnswer.Text + " [" + tbScore.Text + "]";
tbQualDesc.Enabled = true;
tbQuestion.Enabled = true;
lbAnswerList.Enabled = true;
btnRemove.Enabled = true;
btnClear.Enabled = true;
btnEdit.Enabled = true;
btnContinue.Enabled = true;
btnFinished.Enabled = true;
ansEditIndex = 0;
}
else {
//the -1 should be the answer id if it has one
ListItem item = new ListItem(tbAnswer.Text + " [" + tbScore.Text + "]", ((lbAnswerList.Items.Count+1)*-1).ToString());
lbAnswerList.Items.Add(item);
}
tbAnswer.Text = string.Empty;
tbScore.Text = string.Empty;
}
}
开发者ID:SpencerForell,项目名称:Study-Participant-Portal,代码行数:41,代码来源:CreateStudy.aspx.cs
注:本文中的ListItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论