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

Autogenerate Columns

1 Answer 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 01 Aug 2008, 01:27 PM
I am using the demo version 2008 q2 and I am having trouble with the grid autogenerating columns.  I set the datasource of the grid view to a datatable that contains many fields.  I only want 3 fields to be displayed in the grid.  I know I can create a column for every field and then make the fields I do not want displayed to false, but the older version you could set the grid to only display the fields you selected.  How is this done in the new version?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 01 Aug 2008, 02:31 PM
Hello Eric,

Thank you for the question.

However, I am not quite sure about the approach that you want to use. Therefore, I will suggest two approaches:
  1. Set this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = false. Then, create columns for the fields that you want to see.
  2. Set this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = true. Then, from the Property Builder (if the DataSource is set at design-time), or throught the API, set the IsVisible property of the redundant column to false.

If you have additional questions, feel free to contact me.

Kind regards,

Nikolay
the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or