DropDown List control programmatically bind xml datasource
-
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.
-
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.
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. *****