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

RadGrid Xml Help

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Timothy
Top achievements
Rank 1
Timothy asked on 29 Jul 2008, 03:55 PM
Hello,

How would I bind the following XmlDocument to a hierarchical RadGrid (3-levels)?

<xml> 
  <Countries> 
    <Country CountryId="4AB5B619-FC7B-42A1-A82A-D8181EF20F1E" EN="Canada"
      <Provinces> 
        <Province ProvinceId="F75CBB13-8A86-4DE8-81E5-AADF2EEB3827" EN="Ontario"
          <Cities> 
            <City CityId="3478D2E5-1A97-4456-95BF-459E49A55D20" EN="Kitchener" /> 
            <City CityId="C4217DBB-BB4C-438A-8D7C-78A330CEF73D" EN="Waterloo" /> 
          </Cities> 
        </Province> 
      </Provinces> 
    </Country> 
  </Countries> 
</xml> 

I would like to be able to be able to display the "EN" field, here is what I have so far:

<Telerik:RadGrid ID="dgCountries" runat="server" OnNeedDataSource="dgCountries_NeedDataSource" AllowMultiRowEdit="False" AutoGenerateColumns="False" SkinID="Default" Width="800"
    <MasterTableView HierarchyLoadMode="Client"
        <DetailTables> 
            <Telerik:GridTableView runat="server" HierarchyLoadMode="Client" Width="100%"
                <DetailTables> 
                    <Telerik:GridTableView runat="server" Width="100%"
                        <Columns> 
                            <Telerik:GridTemplateColumn> 
                                <ItemTemplate> 
                                    <%# Eval("Name") %> 
                                </ItemTemplate> 
                            </Telerik:GridTemplateColumn> 
                        </Columns> 
                    </Telerik:GridTableView> 
                </DetailTables> 
                <Columns> 
                    <Telerik:GridTemplateColumn> 
                        <ItemTemplate> 
                            <%# Eval("Name") %> 
                        </ItemTemplate> 
                    </Telerik:GridTemplateColumn> 
                </Columns> 
            </Telerik:GridTableView> 
        </DetailTables> 
        <Columns> 
            <Telerik:GridTemplateColumn> 
                <ItemTemplate> 
                    <%# Eval("Name") %> 
                </ItemTemplate> 
            </Telerik:GridTemplateColumn> 
        </Columns> 
    </MasterTableView> 
</Telerik:RadGrid> 

As of right now it is producing "Countries" for each level?

Any help would be greatly appreciated!

Cheers,
Timothy

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 01 Aug 2008, 08:48 AM
Hi Timothy,

How to bind RadGrid programmatically to hierarchical xml data you can see from the following example in the knowledge base section on our site:

http://www.telerik.com/support/kb/article/b454K-ehc-b454T-bhb-b454c-bhb.aspx

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Timothy
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or