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

[Solved] Data from Grid to a tabstrip 'button click'

1 Answer 95 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.
Gerard Eikelboom
Top achievements
Rank 1
Gerard Eikelboom asked on 02 Mar 2011, 12:42 PM
Hello,
I have a question about data wich I have available in my grid how to get it in my tabstrip button click.
In my Grid I have an ID
beside the grid there is an tabstrip with some fields. When I clcik on a row in my grid I retrieve some value using an Ajax call and fill the items on my tabstrip.
When i click the update button I retrieve the Values from my tabstrip via an Ajax call. So far so good.

Is there a way that when I click on the button that I can get the ID from the selected row (Grid)?
A solution (I think) use another hidden field on my tabstrip and put the ID in there When i do a rowselect of the Grid.
But I don't know if there is a nicer way to retrieve the ID when It's needed.

Long story, I hope it makes sense.

Regards,

Gerard Eikelboom 

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 02 Mar 2011, 02:36 PM
Hi Gerard Eikelboom,

 You can do this if your grid is ajax bound (with JavaScript):

var selectedRow = $("#grid tr.t-state-selected");
var dataItem = $("#grid").data("tGrid").dataItem(selectedRow);
var dataKey = dataItem.ID; // or whatever the data key property is called.

If your grid is server bound you can use a hidden field in some column to get that data key (it it is not already bound to a column).

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Gerard Eikelboom
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or