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

[Solved] AutoGenerateColumns to false but...

9 Answers 138 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marc Roussel
Top achievements
Rank 1
Marc Roussel asked on 08 Dec 2009, 04:29 PM
Hi,

I did set the AutoGeneratedColumns to false so I can set the columns myself.  Here's my code :

 

rgvJobs.IsReadOnly = true;

 

rgvJobs.AutoGenerateColumns =

false;

rgvJobs.Columns.Add(
new Telerik.Windows.Controls.GridViewColumn() { Header = "Job ID", Width = 50, IsReadOnly = true });
rgvJobs.Columns.Add(
new Telerik.Windows.Controls.GridViewColumn() { Header = "Job Date", Width = 120, IsReadOnly = true });
rgvJobs.Columns.Add(
new Telerik.Windows.Controls.GridViewColumn() { Header = "Job Status", Width = 50, IsReadOnly = true });

 

rgvJobs.ItemsSource = _Jobs;

 

However, the grid shows the right number of rows but all the cells are empty.  Any toughts ?

However, the grid shows the right number of rows but all the cells are empty.  Any toughts ?

 

9 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Dec 2009, 04:31 PM
Hello,

 You may need to set DataMemberBinding for these columns.

Sincerely yours,
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
Marc Roussel
Top achievements
Rank 1
answered on 08 Dec 2009, 04:34 PM
This property doesn't exist when I issue a , and see with the intellisence
0
Vlad
Telerik team
answered on 08 Dec 2009, 04:39 PM
Hi,

 Can you verify if you have all needed references: Telerik.Windows.Controls.dll, Telerik.Windows.Data.dll, Telerik.Windows.Controls.Input.dll and Telerik.Windows.Controls.GridView.dll?

Please post also more info about your grid version.

Sincerely yours,
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
Marc Roussel
Top achievements
Rank 1
answered on 08 Dec 2009, 04:44 PM
Yes I have them all
The version is your demo I just downloaded from your site
2009.3.1103.1030
0
Marc Roussel
Top achievements
Rank 1
answered on 08 Dec 2009, 10:09 PM
We're about to buy a few licenses and it's important to us to be able to set our columns easily by code not relying on complex templating and beeing able to change simple things like the Text shown on the GridViewGroupPanel.

Thank you
0
Vlad
Telerik team
answered on 09 Dec 2009, 06:37 AM
Hello Marc,

 Indeed you can do all these however I'm not sure why you don't see simple things like DataMemberBinding. Can you send us an example where this can be reproduced?


Sincerely yours,
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
Marc Roussel
Top achievements
Rank 1
answered on 09 Dec 2009, 03:06 PM
In this Repro, The references to your demo dll will not be found so reinsert them and also you can't compile since I voluntary made errors to shouw you that the DataMemberBinding isn't there

Repro Project


Let me know...
0
Accepted
Vlad
Telerik team
answered on 09 Dec 2009, 03:23 PM
Hello,

Generally DataMemberBinding is available on GridViewDataColumn - GridViewColumn is unbound. Sorry I've missed this in my first reply.


Regards,
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
Marc Roussel
Top achievements
Rank 1
answered on 09 Dec 2009, 04:49 PM

Great.  With your help I've been able to mount the right line. 

Here it is :

 

rgvJobs.Columns.Add(

new Telerik.Windows.Controls.GridViewDataColumn() { Header = "Job ID", Width = 80, IsReadOnly = true, DataMemberBinding = new System.Windows.Data.Binding("JobId") });

So the bottom line is that you need to use the GridViewDataColumn for the Add and I was using GridViewColumn which was my mistake.

Thank you

 

Tags
GridView
Asked by
Marc Roussel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Marc Roussel
Top achievements
Rank 1
Share this question
or