Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DropDown List control programmatically bind xml datasource

DropDown List control programmatically bind xml datasource

Scheduled Pinned Locked Moved ASP.NET
questiondesignxml
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    swjam
    wrote on last edited by
    #1

    I have a XmlDocumentFragment whose InnerXml is = <n1:Item xmlns:n1="http://abc.def.sg/XMLSchema/Web/Services/MyWebServiceContracts"> <n1:Text>Level1A_Text</n1:Text> <n1:Value>Level1A_Value</n1:Value> <n1:Items> <n1:Item> <n1:Text>Level_2A_Text</n1:Text> <n1:Value>Level_2A_Value</n1:Value> <n1:Items /> </n1:Item> <n1:Item> <n1:Text>Level2_B_Text</n1:Text> <n1:Value>Level2_B_Value</n1:Value> <n1:Items /> </n1:Item> </n1:Items> </n1:Item> How do I programmatically bind my drop down list control to this XmlDocumentFragment.InnerXml such that it goes to "Item/Items/Item/" and my ddl gets value from Value and text from Text? Thank you many in advance. ps most examples I have seen are bound @design. The programmatic ones aren't too clear.

    ---------------------------------------------------------- Lorem ipsum dolor sit amet.

    L 1 Reply Last reply
    0
    • S swjam

      I have a XmlDocumentFragment whose InnerXml is = <n1:Item xmlns:n1="http://abc.def.sg/XMLSchema/Web/Services/MyWebServiceContracts"> <n1:Text>Level1A_Text</n1:Text> <n1:Value>Level1A_Value</n1:Value> <n1:Items> <n1:Item> <n1:Text>Level_2A_Text</n1:Text> <n1:Value>Level_2A_Value</n1:Value> <n1:Items /> </n1:Item> <n1:Item> <n1:Text>Level2_B_Text</n1:Text> <n1:Value>Level2_B_Value</n1:Value> <n1:Items /> </n1:Item> </n1:Items> </n1:Item> How do I programmatically bind my drop down list control to this XmlDocumentFragment.InnerXml such that it goes to "Item/Items/Item/" and my ddl gets value from Value and text from Text? Thank you many in advance. ps most examples I have seen are bound @design. The programmatic ones aren't too clear.

      ---------------------------------------------------------- Lorem ipsum dolor sit amet.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can say, something like: DropDownList1.DataSource = doc.ChildNodes[0].ChildNodes; DropDownList1.DataTextField = "InnerText"; DropDownList1.DataValueField = "InnerText"; DropDownList1.DataBind(); you ahve break up precisely at required parent.

      ***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups