Posts
391
Comments
137
Trackbacks
0
Die Inhalte einer Liste einer Dropdown-Liste zuzuweisen

Anbei ein kleines Skript um die Inhalte einer Liste einer Dropdown-Liste zuzuweisen:

String _Site = "URL";

 

private void GetListItems() {

   using (SPSite site = new SPSite(_Site))

   {

      using (SPWeb web = site.OpenWeb())

      {

         SPList list = web.Lists["ListName"];

         DropDownListScenario1.Items.Add(new ListItem("select a listitm:", ""));

         foreach (SPListItem i in list.Items)

         {

            DropDownListScenario1.Items.Add(new ListItem(i.Title,

            Convert.ToString(i["Url"])));

         }

      }

   }

}

posted on Saturday, December 13, 2008 9:49 AM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 1 and 8 and type the answer here: