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

Binding to RadGridView

2 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Shivam
Top achievements
Rank 1
Shivam asked on 02 Jan 2012, 02:16 PM
How can I bind RadGridview itemsource directly to a XElement ?  Is this feature supported by RadGridview ?

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 02 Jan 2012, 02:44 PM
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 >>

0
Shivam
Top achievements
Rank 1
answered on 02 Jan 2012, 04:48 PM
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 ??
Tags
GridView
Asked by
Shivam
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Shivam
Top achievements
Rank 1
Share this question
or