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


C# ListItem类代码示例

本文整理汇总了C#中ListItem的典型用法代码示例。如果您正苦于以下问题:C# ListItem类的具体用法?C# ListItem怎么用?C# ListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ListItem类属于命名空间,在下文中一共展示了ListItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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