Binding to RadGridView

3 posts, 0 answers
  1. Shivam
    Shivam avatar
    4 posts
    Member since:
    Jan 2012

    Posted 02 Jan 2012 Link to this post

    How can I bind RadGridview itemsource directly to a XElement ?  Is this feature supported by RadGridview ?
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 Jan 2012 Link to this post

    Hi Shivam ,

    No, directly not , but you can bind to the collection returned by the XElement.Elements() method.

    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Shivam
    Shivam avatar
    4 posts
    Member since:
    Jan 2012

    Posted 02 Jan 2012 Link to this post

    My XElement.Elements()is returning this XML  


    <
    Student>
      
    <Element Name = "abc" Class = "4" Section = "A" />
    <Element Name = "abc" Class = "4" Section = "A" />
    <Element Name = "abc" Class = "4" Section = "A" />
      
    </Student>


    and i need to bind this data to the columns of my gridview as shown in XAML :

    <telerikGridView:RadGridView.Columns>
                      
    <telerikGridView:GridViewDataColumn 
    Header="Name" 
    Width="*"
    IsSortable="True"  
    HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}" 
    IsReadOnly="False"
     DataMemberBinding="{Binding Name}" />
                     
     <telerikGridView:GridViewDataColumn
     Header="Class" 
    Width="*"
     IsSortable="True"
     HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
     IsReadOnly="False"
     DataMemberBinding="{Binding Class}"/>
                      
    <telerikGridView:GridViewDataColumn 
    Header="Section" 
    Width="*"
     IsSortable="True"
     HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
     IsReadOnly="False" 
    DataMemberBinding="{Binding Section}"/>
      
    </telerikGridView:RadGridView.Columns>

    I have tried to bind gridview with XElement.Elements() dynamically ..

    Number of rows and columns generated are correct but cells are empty. respective attributes of the element are not binded properly.

    Is there any binding format or different method to bind attributes of element in XML to  gridview ??
Back to Top