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

[Solved] Add Hidden Field to Grid

4 Answers 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mvcuser
Top achievements
Rank 1
mvcuser asked on 22 Feb 2010, 09:42 PM
Hi,

In a Grid, i'd like to add a hidden column with the ID value to each row which I can then click on and call JSON to retrieve data for a specific row. It works fine when the column is visible but I couldn't find a way to hide that column from the user? Tried using .Visible(false) but that completely removes it. Also tried to make the column style hidden BUT it still shows the column heading ID etc.

Need to retrieve the value using:
var someID = this.cells[0].innerHTML;

Thanks!

4 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 23 Feb 2010, 07:26 AM
Hello mvcuser,

This is currently not possible without using some JavaScript. Please check this forum thread for the required code.

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
mvcuser
Top achievements
Rank 1
answered on 23 Feb 2010, 02:31 PM
Solution:

- Make the ID column the last column in the Grid then do the following, don't forget .Width(0):

columns.Add(c => c.Id).Width(0).HeaderHtmlAttributes(new {style="display:none"}).HtmlAttributes(new {style="display:none"});

HTH
0
Richard Guo
Top achievements
Rank 1
answered on 06 Mar 2010, 02:24 AM
Hi mvcuser,
That's the best work around so far. It works perfect in IE and Firefox. However, in Opera and Chrome, the last column still shows although it is blank. The width of the last column could not be 0. Can someone find a work around for this problem? Thanks.
0
khaldoun
Top achievements
Rank 1
answered on 09 Jun 2011, 07:03 PM
I have the same prb . Did you find a solution?
Tags
Grid
Asked by
mvcuser
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
mvcuser
Top achievements
Rank 1
Richard Guo
Top achievements
Rank 1
khaldoun
Top achievements
Rank 1
Share this question
or