loading a window with xmlDocument data

6 posts, 0 answers
  1. Steve Holdorf
    Steve Holdorf avatar
    119 posts
    Member since:
    Apr 2010

    Posted 05 May 2012 Link to this post

    I am designing a site that will use telerikajax  windows to load it's controls from an xmlDocument. On the telerik window 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 telerik window's controls (bind the data) from the xml tree contained in the xmlDocument?

    Thanks,

    Steve Holdorf
  2. Steve Holdorf
    Steve Holdorf avatar
    119 posts
    Member since:
    Apr 2010

    Posted 05 May 2012 Link to this post

    Also, 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.
  3. Steve Holdorf
    Steve Holdorf avatar
    119 posts
    Member since:
    Apr 2010

    Posted 05 May 2012 Link to this post

    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 rad window controls with the detail data and so forth going into more detail with each selection.
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5706 posts

    Posted 08 May 2012 Link to this post

    Hi Steve,

    You can add an update panel in the RadWindow's content template (as explained in this help article) so that you avoid full postbacks that will close the RadWindow. Then you can add controls to this update panel's content template in the way to do with the rest of your application. The RadWindow in this case is merely a movable container so the logic you have already set up should work fine with it. As for accessing the service for the XML document only once - you can save it in the session or server cache (e.g. in the Session_Start event or in the first page_load) then later check for it there and load it only if it is not present for some reason. You can also subscribe to the menu's server events and set the needed values from your XML file again as needed. You may find useful this demo and this article on creating a grid from an XML document and this demo on using an XML datasource for editing.


    Regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. Steve Holdorf
    Steve Holdorf avatar
    119 posts
    Member since:
    Apr 2010

    Posted 09 May 2012 Link to this post

    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!

    Steve Holdorf
    holdorfs.ctr@jdi.socom.mil 
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5706 posts

    Posted 10 May 2012 Link to this post

    Hi Steve,

    How to traverse the XML file and take the data from there is up to the developer. The RadConrtols offer many properties that can be set according to the data you already have, databinding can be done to, for example, a simple array that you can create with your data from the XML. More information about working with XML files in the code-behind is available in the net, for example by starting from this google search. Please also note that the first help article and demo I linked create a RadGrid from a declaration stored in an XML file.


    Regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top