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

Programatically Creating RadGridview and columns

3 Answers 254 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rana Pratap
Top achievements
Rank 1
Rana Pratap asked on 29 Oct 2009, 05:25 PM
Hi,

I am using Telerik silverlight controls  Q2 2009 , i have a requirement where i have to create grid view and columns dynamically in xaml.cs file, I also need to create dropdown and datepicker controls in edit mode through programatically. Please provide if any sample code avilable with similar kind of requirement.

Thanks in advance

Rana Pratap

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 30 Oct 2009, 07:05 AM
Hi,

There is nothing special in RadGridView and/or columns programmatic creation - here is an example:

var grid = new RadGridView();
grid.Columns.Add(new GridViewDataColumn(){ Header = "ID", DataMemberBinding = new Binding("ID") });

If you want to create however columns with custom CellTemplate and/or CellEditTemplate my suggestion is to inherit from GridViewDataColumn, override CreateCellElement and/or CreateCellEditElement and return your desired control.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
William
Top achievements
Rank 1
answered on 07 Nov 2016, 08:40 PM
This is not what various other posts have said - they all lead to "Changing the Grid Structure Dynamically on Postback" as the preferred way to change the structure. Which one is right? And is the documentation on this page only for "UI for Asp.Net" or does it also apply to "UI for WPF"?
0
Stefan
Telerik team
answered on 09 Nov 2016, 10:43 AM
Hi William,

Actually, this forum section is for the UI for Silverlight suite. In order to keep the threads consistent, I would kindly ask you to post your question in the relevant section.

Thanks in advance for your cooperation.

Regards,
Stefan X1
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Rana Pratap
Top achievements
Rank 1
Answers by
Vlad
Telerik team
William
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or