Hello I am using Telerik Rad Controls for the DataGrid view…
I want to display only some required columns in the DataGrid.. so I used this code
<telerik:RadGridView.Columns>
<telerik:GridViewColumn Header="Market Code" />
<telerik:GridViewColumn Header="Market Name" />
</telerik:RadGridView.Columns>
But I was not able to set the binding.. I was not able to set the DataMemberBinding to the column…
It says the property was not found in the GridViewColumn….
<riaControls:DomainDataSource AutoLoad="True"
Height="0"
LoadedData="mKT_MSTRDomainDataSource_LoadedData_1"
x:Name="mKT_MSTRDomainDataSource"
QueryName="GetMKT_MSTRQuery" Width="0" >
<riaControls:DomainDataSource.DomainContext>
<my:GNDataDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<telerik:RadGridView Grid.Column="1" AutoGenerateColumns="False"
ItemsSource="{Binding Data,
ElementName=mKT_MSTRDomainDataSource}"
x:Name="mKT_MSTRRadGridView" Width="Auto"
Canvas.Left="290" Height="300" >
<telerik:RadGridView.Columns>
<telerik:GridViewColumn Header="Market Code" DataMemberBinding="" />
<telerik:GridViewColumn Header="Market Name" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Can anyone help me where am I making mistake… please
You need to choose an appropriate type of column for binding, e.g. GridViewDataColumn, etc. depending on your data type. You can see the list of pre-defined column types here.
You then need to bind the columns to the data you want to display, with the DataMemberBinding attribute:
where MarketCode and MarketName are properties on your data records