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

radGridView auto gen columns

10 Answers 129 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul Gallen
Top achievements
Rank 1
Paul Gallen asked on 26 Sep 2008, 11:49 AM
Hi

I am new to the radGridView windows control, may I ask a couple of questions?

1. I have a data source of 20 columns/properties, but i only require to display 5 of them in the grid. I have manually added the columns that I require to the grid. When binding to the data source all of the remaining columns are loaded as well, how can I stop this auto generation of columns?

2. In the Property Builder design view of the grid I, have created a view and added the required columns. Can I add another view and add another set of columns (all from the same data source)?

Thanks

P

10 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 26 Sep 2008, 06:29 PM
Hello Paul Gallen,

Thank you for the questions.

To avoid auto generating columns you have to set AtoGenerateColumns property of GridViewTemplate to false:
this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = false

Concerning your second questions, I am afraid that I cannot understand exactly what you want to achieve. Actually, you can add other templates but please send me more detailed description about your scenario. This way I can provide you with more accurate assistance.

I am looking forward to your reply.
 

Best wishes,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 29 Sep 2008, 11:16 AM
Sorry for my poor explanation. What I am trying to achieve is this; With the same data source and grid I would like to view my data in a different way, without having to create another grid, (or views on top of my data source). I think 'adding other templates' sounds good, how is this achieved?

Thanks

P
0
Martin Vasilev
Telerik team
answered on 01 Oct 2008, 04:14 PM
Hi Paul,

Thank you for the additional details.

RadGridView has only one MasterGridViewTemplate and it cannot be changed. In this regard, you cannot create different templates for different data representations and switch between them. Child template creation serves to provide flexible customization only for hierarchy.

Nevertheless, RadGridView has a very rich API and you can implement run-time customization to change how to represent the data from the data source. To provide you with additional directions I will need more details about your scenario. It will be very helpful if you send me a small example application attended with descriptions what exactly you want to achieve.

I am looking forward to your answer.

Best wishes,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 06 Oct 2008, 08:10 AM
Thanks Martin,

Is there any examples on how to change the look and feel of the radGridView?

Also Martin, I am unable to find AutoGenerateColumns property, either in code, or from the property window in design mode, very puzzling???
this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns)




0
Martin Vasilev
Telerik team
answered on 08 Oct 2008, 09:43 PM
Hello Paul,

Thank you for getting back to me.

You could find information about changing the Look and feel of RadGridView in our Examples application and in the help documentation:
http://www.telerik.com/help/winforms/grid_using-themes-with-radgridview.html
http://www.telerik.com/help/winforms/grid_modifying-themes-tutorial.html
 
You could also take a look to our KB articles section, Code Library and HelpDesk sample application

AutoGenerateColumns property is not present in the Property grid. You could access it in run-time via code:
 
this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = false;  

If you have additional questions, do not hesitate to contact me again.

Best wishes,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 09 Oct 2008, 11:15 AM
Hi Martin,

Thanks for the info.

I am still unable to locate 

this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns =

in code, very puzzling???

P

0
Martin Vasilev
Telerik team
answered on 10 Oct 2008, 12:02 PM
Hi Paul Gallen,

Thank you for writing.

Please, find attached a project that demonstrates the usage of the AutoGenerateColumns property.

Hope this helps. Contact me again if you need additional assistance.


Best wishes,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 10 Oct 2008, 04:03 PM
Thanks Martin for your perseverance.

~I  think I know what the problem is. I am using VB and AutoGenertateColumns does NOT show in code. It does , as you have just demonstrated, show in the C# environment

very strange...


P


0
Martin Vasilev
Telerik team
answered on 13 Oct 2008, 04:04 PM
Strange indeed - there is no reason for the intellisense to not show the AutoGenerateColumns property. Nevertheless, the code in VB.Net is almost the same:
 
Me.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = False 

I have converted the previous example in VB.Net and you can find it attached to this message. Also you could use the the Telerik online conversion tool to change code between C# and VB.Net: http://codechanger.com/

Hope this is useful to you. Contact me again if you have other questions.

 
All the best,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 13 Oct 2008, 04:21 PM
Thanks Martin,

I become to rely on the IDE too much (I think)

Best

P
Tags
General Discussions
Asked by
Paul Gallen
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Paul Gallen
Top achievements
Rank 1
Share this question
or