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

Adding TemplateField columns to Rad Grid

1 Answer 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 29 Apr 2009, 04:47 PM

Hi,

I'm new to RadGrid so sorry if this is a silly question.

I have an application where I am adding 'custom columns' to a DataGrid. My custom column is a class i have created that derives from TemplateField.

I now need to freeze the first column of the DataGrid so i am trying to migrate from a standard gridview to a RadGrid.

My question is how can I programmatically add TemplateFields to a RadGrid?

Example code from my application:

// custom class that represents a column in a GridView
public class CustomColumnTemplate : TemplateField// code removed for brevity }

// custom class that represents the ItemTemplate for CustomColumnTemplate
public
class BaseSetOfValuesColumn : ITemplate{ // code removed for brevity }

//  code to add custom columns to GridView
CustomColumnTemplate 
sovCol = new CustomColumnTemplate();
sovCol .ItemTemplate = new SetofValuesColumn();
myGridView.Columns.Add(sovCol);

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 29 Apr 2009, 09:37 PM
Hello Ian,

I recommend you examine the following link:
Programmatic creation (Creating template columns programmatically section)

Kind regards,
Daniel
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.
Tags
Grid
Asked by
Ian
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or