This is a migrated thread and some comments may be shown as answers.

Grid bound to XML

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 10 May 2012, 12:15 PM
I am trying to bind a grid to this xml

<?xml version="1.0" encoding="utf-8"?>
<Sites>
  <Site Name="Name" URL="www.google.com" >
    <KPIData StartDate="2012-04-01"></KPIData>
  </Site>
 
</Sites>


It works apart from the last column and I can't work out how to get it to appear.  I suspect it needs a selector but haven't been able to find out how to do it.  Here is my ASPX page

<Columns>
      <telerik:GridBoundColumn DataField="Name"
          FilterControlAltText="Filter Name column" HeaderText="Site Name" SortExpression="Name"
          UniqueName="Name">
      </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="URL"
          FilterControlAltText="Filter URL column" HeaderText="URL" SortExpression="URL"
          UniqueName="URL">
      </telerik:GridBoundColumn>
      <telerik:GridBoundColumn DataField="GATableID"
          FilterControlAltText="Filter GATableID column" HeaderText="GA Profile Id" SortExpression="GATableID"
          UniqueName="GATableID">
      </telerik:GridBoundColumn>
 
 
       <telerik:GridBoundColumn DataField="/KPIData[@StartDate]"
          FilterControlAltText="Filter StartDate column" HeaderText="StartDate" SortExpression="StartDate"
          UniqueName="StartDate">
      </telerik:GridBoundColumn>
  </Columns>

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 11 May 2012, 10:00 PM
Dan:

I put a fair amount of time and effort into getting this to work, but it appears that the declarative method for the RadGrid only works with  flat XML Data, and there's no way to access nested data attributes.

It looks like you will have to create your RadGrid programmatically. This should help (although the code gets cut off for me):

Binding RadGrid programmatically to hierarchical XML data

Hope this helps!
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or