Last post May 10, 2012 08:04 AM by RichardY
May 05, 2012 08:29 AM|Steve Holdorf|LINK
I am designing a site that will use ajax panel to load it's controls from an xmlDocument. On the ajax panel I will have several asp:Label, asp:textbox, asp:Listbox, and radgrid controls. Now, my data will consist of the content of nodes from an xmlDocument.
How do I populate the ajax panel's controls (bind the data) from the xml tree contained in the xmlDocument?
May 05, 2012 09:19 AM|RichardY|LINK
If your issue is solely databinding controls to xmldocument, then use an xmldatasource control. Google/Bing for many examples. Here's one:
May 05, 2012 10:34 AM|Steve Holdorf|LINK
Thank you for you example but I was wondering if there was a way to do this in the code behind one setting the value of one control at a time? See what I am doing is filling an xmlDocument onLoad then using it for display through out the whole application.
May 05, 2012 10:43 AM|RichardY|LINK
Do you need help in creating instances of the controls in the code behind or in parsing the xml document? Or something else?
May 05, 2012 12:44 PM|Steve Holdorf|LINK
What I am doing is in the OnLoad page event for the main page I want to load an XMLDocument from a wcf service pulling the data from a list of SharePoint items, then not have to hit the web service again. Next, I want to fill the top level navigation control
with the top level nodes of the xmlDocument. Now, once the user selects a menu option I want to populate and display/hide child controls with the detail data and so forth going into more detail with each selection.
May 09, 2012 06:51 AM|Steve Holdorf|LINK
Read your reply and thank you very much! What I am doing is going to have a master page with a rad menu and use your AJAX tool kit to load and unload custom controls, like in your demos. I guess my biggest problem is, with only a single XMLDocument with
all of the data contained, iterating through it and pulling out the top root level nodes for the menu. Then once a root level node menu item is selected getting that node's second level child node data to fill the 1st level custom control (i.e. text fields
and drop down fields). Then once a second level child node's data dropdown is selected then filling the 2nd custom control with that main root's third level child node data, etc. I don't think I can bind directly anywhere as I feel that some sore of iteration
methods must be used. I think the xml will be 3 - 4 levels deep and will be the only data source for my catalog application. Have you had any dealings with such a seniro and if so any good links. The links you sent me before were mostly binding to an xmldatasource,
and not using xmlDocument iteration and dynamically loading controls which I must do in my case. In my case binding directly to xml is not an option unless I can pull child node sections in to an xml source that will allow for binding. Any help would be great
and as always thanks for your help!
May 10, 2012 08:04 AM|RichardY|LINK
Your question is still of a general nature so here are my thoughts. You can query the xml using either the .Net XmlDocument XPATH methods or using Linq to XML. You can Google/Bing for many examples.
If you have a RAD Menu control you can bind it to an XmlDatasource: