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

Autogenerated columns - does anyone use it?

5 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
improwise
Top achievements
Rank 1
Iron
Iron
improwise asked on 01 Aug 2010, 11:44 AM
Mostly out of curiosity, I am wondering if anyone actually uses the Autogenerated Columns feature? There are several reasons I never use it (mainly that I want more control over how it looks) but the biggest reason of them all is that the names the columns have in the database almost never are what you want the user to see. Considering that this option is almost at the top of the Smart-tag in Visual Studio, at least Telerik must think that a lot of people use this, so I cant help wondering, "is there a smart way of using autogenerated columns that I just dont know about??"

5 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 03 Aug 2010, 02:17 PM
Hello Patrik,

The main advantage of using autogenerated columns is that they make the RadGrid instance flexible to data source changes. Thus, you can easily reuse the RadGrid implementation over various data sources.

As to the columns' HeaderText property- it can be changed in the RadGrid ColumnCreated server-side event handler along with other properties of the columns, if needed.

Sincerely yours,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tom M
Top achievements
Rank 1
answered on 03 Aug 2010, 06:40 PM
Hi Tsvetina,

Do you know of any instructional material on how to accomplish this?

Many Thanks,
Tom
0
Tsvetina
Telerik team
answered on 04 Aug 2010, 11:04 AM
Hello Tom,

I am attaching a sample project demonstrating how RadGrid easily generates columns when the datasource is changed. In this case I created two different AccessDataSources with different type and number of fields. You can see that by just changing the DataSourceID property of RadGrid, the control handles the change with no problem.

I also implemented a custom method which in this case splits the header text at capital letters, so the HeaderText property gets a more user friendly look. The method is called in the OnColumnCreated server-side event of RadGrid.

Greetings,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tom M
Top achievements
Rank 1
answered on 05 Aug 2010, 07:28 PM
Thank you Tsvetina! This has become clear to me now. Your example is much appreciated.

Kind Regards,
Tom
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 11 Aug 2010, 09:08 PM
Well, that is nice, but it really doesn't answer my question, which wasn't really how to use it, but if anyone actually do it :)

Biggest reason I ask this is actually to learn from the community if there is any good way of using a feature like this, as I just can't see the benefit myself. Maybe you could put the actual header name you want in the table, and you could also put in a flag if you want the column to be visible or not which you would then have to handing in the grid, but is this something anyone uses? And if so, what are your experiences with it compared to modifying the grid design time? One advantage maybe could be in case you want to implement support for several langagues or similar. Again, please note that I am not out to nag here, I want to learn.
Tags
Grid
Asked by
improwise
Top achievements
Rank 1
Iron
Iron
Answers by
Tsvetina
Telerik team
Tom M
Top achievements
Rank 1
improwise
Top achievements
Rank 1
Iron
Iron
Share this question
or