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

[Solved] Write data key of a selected row to a property of the model

1 Answer 69 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.
Simon
Top achievements
Rank 1
Simon asked on 23 Apr 2012, 04:35 PM
Hello,

I have got a grid which uses ajax binding to get items. The grid is on a razor view and this view has a model. 
How can I write the defined data key of the selected row to a property of the model??
If the information is important: the property is binded to a textbox.

1 Answer, 1 is accepted

Sort by
0
Pechka
Top achievements
Rank 1
answered on 24 Apr 2012, 07:05 AM
Yo

Use this event http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-client-api-and-events.html#OnRowSelect 

to set the value of your TextBox (also you will probably need this method to get the key property of the dataItem )- this way when you post the page your model property will also be updated when you call the UpdateModel method.
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Pechka
Top achievements
Rank 1
Share this question
or