This question is locked. New answers and comments are not allowed.
OK,
So I followed the example in the help files under Grid->DataBinding->AjaxBinding thus: -
So now I am binding my grid to my IEnumerable of Orders ( a sub-filed in the ViewModel). All well and good. Except for 1 problem...
The grid is showing a wrong column "Entity State" which I can't get rid of using .Visible(false) nor using .Hidden(True). If I use Visible() or Hidden, then I simply lose the entire grid !
How can we fix that. I have even tried a data annotation set-up for that column which doesn't work...
Please Help...
So I followed the example in the help files under Grid->DataBinding->AjaxBinding thus: -
So now I am binding my grid to my IEnumerable of Orders ( a sub-filed in the ViewModel). All well and good. Except for 1 problem...
The grid is showing a wrong column "Entity State" which I can't get rid of using .Visible(false) nor using .Hidden(True). If I use Visible() or Hidden, then I simply lose the entire grid !
How can we fix that. I have even tried a data annotation set-up for that column which doesn't work...
Please Help...
6 Answers, 1 is accepted
0
Hi Paul,
Atanas Korchev
the Telerik team
Entity State may appear if you are using auto generated columns and entity framework. Is this the case? The grid creates a column for every public property of your model which includes EntityState for EF models. The solution is to define the columns which the grid must display:
<%= Html.Telerik().Grid()
.Columns(columns =>
{
columns.Bound(c => c.Name);
columns.Bound(c => c.ID);
})
%>
Atanas Korchev
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
Paul
Top achievements
Rank 1
answered on 13 Jun 2011, 04:02 PM
Isn't that what DataAnnotations are for though ?...
i.e. ScaffoldColumn - or does the grid ignore this and its only applicable to Forms.
Is there any way to decorate the Entity with Metadata to include/exclude columns for telerik grids ?
Paul.
i.e. ScaffoldColumn - or does the grid ignore this and its only applicable to Forms.
Is there any way to decorate the Entity with Metadata to include/exclude columns for telerik grids ?
Paul.
0
Hi Paul,
Atanas Korchev
the Telerik team
If you decorate a property with [ScaffoldColumn(false)] it will not be displayed by the grid.
Regards,Atanas Korchev
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
Paul
Top achievements
Rank 1
answered on 14 Jun 2011, 06:39 AM
Now I understand...
Once you "take control" of the columns by using the ".Columns()" construct, you are in effect telling the grid to stop auto-generating and use what you tell it to use in the statements that follow.
I [rather stupidly] thought that you were setting attributes of the columns that the grid had already decided to render.
It isn't all that clear that this is what happens though - I'm quite sure I'm not the first to get caught like this or that I will be the last !...
BUT - Thanks for all your help & support - its greatly appreciated especially since the MVC stuff is "just so cheap" ;-)
Actually; it would be good to still allow auto-generation with Data Annotations and the like, but provide a further mechanism to "hide" the auto-generated columns from the grid without taking full control over the columns and completely losing the auto-generate feature. Next release perhaps ?... :-)
Paul.
Once you "take control" of the columns by using the ".Columns()" construct, you are in effect telling the grid to stop auto-generating and use what you tell it to use in the statements that follow.
I [rather stupidly] thought that you were setting attributes of the columns that the grid had already decided to render.
It isn't all that clear that this is what happens though - I'm quite sure I'm not the first to get caught like this or that I will be the last !...
BUT - Thanks for all your help & support - its greatly appreciated especially since the MVC stuff is "just so cheap" ;-)
Actually; it would be good to still allow auto-generation with Data Annotations and the like, but provide a further mechanism to "hide" the auto-generated columns from the grid without taking full control over the columns and completely losing the auto-generate feature. Next release perhaps ?... :-)
Paul.
0
Hi Paul,
Atanas Korchev
the Telerik team
This is actually possible already. Go check the autogenerated columns example. The description shows how to hide an autogenerated column.
Kind regards,Atanas Korchev
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
Paul
Top achievements
Rank 1
answered on 14 Jun 2011, 08:16 AM
Hey, cool, I really should jump on the web-site and look at the examples more often.
I just sit here behind my companies slooooow internet connection with my help files.
I just sit here behind my companies slooooow internet connection with my help files.