respectfully,
i want to programmatically create a custom schema (create columns in custom without binding) and fill the gridview with custom data ( add new rows without binding )! I found that the wpf radgridview do not have the rows collection and it seems that is necessary to bind radgridview to a data source for displaying data, but i want to add new rows and columns programatically at run time even if i bound it to data source before! is there any approach for this purpose?!
thanks for your kindness ;)
i want to programmatically create a custom schema (create columns in custom without binding) and fill the gridview with custom data ( add new rows without binding )! I found that the wpf radgridview do not have the rows collection and it seems that is necessary to bind radgridview to a data source for displaying data, but i want to add new rows and columns programatically at run time even if i bound it to data source before! is there any approach for this purpose?!
thanks for your kindness ;)
4 Answers, 1 is accepted
0
Hi Meisam,
Currently the grid does not support unbound mode but there is a workaround that might work for your scenario. You can bind the grid to an empty observable collection and add your items to that collection, instead of directly adding the items to the grid.
RadGridView has a collection called Columns which you can use to add/remove columns prgramatically.
I have created a sample to illustrate that scenario.
Greetings,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Currently the grid does not support unbound mode but there is a workaround that might work for your scenario. You can bind the grid to an empty observable collection and add your items to that collection, instead of directly adding the items to the grid.
RadGridView has a collection called Columns which you can use to add/remove columns prgramatically.
I have created a sample to illustrate that scenario.
Greetings,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Meisam
Top achievements
Rank 1
answered on 19 Jul 2009, 01:10 PM
thank you so much,
that's nice for master tables, but in hierarchy custom approach, how can i modify the child table schema? for example, it bounded to some collection (child collection of the master collection) that i don't want to display some properties of that.
i hope my explanation was clear.
Kind regards
that's nice for master tables, but in hierarchy custom approach, how can i modify the child table schema? for example, it bounded to some collection (child collection of the master collection) that i don't want to display some properties of that.
i hope my explanation was clear.
Kind regards
0
Hello Meisam,
Thre is not problem to show a subset of the original properties in a child grid. You just need to provide a new HierarchyChildTemplate, which is a piece of cake.Since you are using 2009.1.526 version of RadGridView you have to do a little bit more work due to some issues in the grid.
I have updated the sample application which now displays only one column in a child grid for an object that has many properties.
If you decide to upgrade to our latest version (Q2) you will be able to achive the same effect without any code behind - you will only need to do something like that:
Hope this helps.
Kind regards,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thre is not problem to show a subset of the original properties in a child grid. You just need to provide a new HierarchyChildTemplate, which is a piece of cake.Since you are using 2009.1.526 version of RadGridView you have to do a little bit more work due to some issues in the grid.
I have updated the sample application which now displays only one column in a child grid for an object that has many properties.
If you decide to upgrade to our latest version (Q2) you will be able to achive the same effect without any code behind - you will only need to do something like that:
<telerik:RadGridView Name="RadGridView1"> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<telerik:GridViewDataControl AutoGenerateColumns="False"> |
<!-- Choose which columns will be displayed in child grids--> |
<telerik:GridViewDataControl.Columns> |
<telerik:GridViewDataColumn DataMemberPath="Memo2"/> |
</telerik:GridViewDataControl.Columns> |
</telerik:GridViewDataControl> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
Hope this helps.
Kind regards,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Meisam
Top achievements
Rank 1
answered on 26 Jul 2009, 05:45 AM
Hi Milan,
Thanks a lot,
because I have multiple child definitions, I think I can't use this approach. Currently I implement that in this way:
for each child definition.
I will be happy if i know your idea,
Best Wishes
Thanks a lot,
because I have multiple child definitions, I think I can't use this approach. Currently I implement that in this way:
GridViewDataColumn columnCI_NAME = new GridViewDataColumn(); |
columnCI_NAME.DataMemberBinding = new Binding("CI_NAME"); |
columnCI_NAME.HeaderText = "CI NAME"; |
detailDefinition.FieldDescriptors.Add(columnCI_NAME); |
for each child definition.
I will be happy if i know your idea,
Best Wishes