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

[Solved] How to get model bound with grid on postback?

3 Answers 136 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.
Kapil Koli
Top achievements
Rank 1
Kapil Koli asked on 08 Mar 2010, 06:59 AM
Hi,

    I am facing a problem while handling postback for my view which contains telerik grid and a button.
    I am not getting the model bound with the grid in my postback action.
    The scenario is as follows.
        I have a simple class person.cs with two fields id and name.
        My view contains telerik grid and a button. The populated class object array is passed to this view.
        The grid shows the data properly. Now I want to get this bound model back in my post action.
        I want to achieve this on a button click.
        But unfortunately, the post action methods receives nothing. Formcollection also doesn't contain anything.
        How can i get the entire model bound with grid on postback?

Thanks in advance,
Kapil
        

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Mar 2010, 08:25 AM
Hello Kapil Koli,

This is not possible. You should get the bound model by requesting the data store (database, repository etc) in your action method. The grid does not serialize its model so there is no way you get it back after postback.

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
georges
Top achievements
Rank 1
answered on 30 Mar 2011, 06:42 PM
Great.  You told him how it can't be done.  Now could you please give him some direction to accomplish what he's trying to do?  I have a similar issue and nothing in your response has given any guidance as to what to do next or even a reference to an example project you may have.
0
Atanas Korchev
Telerik team
answered on 31 Mar 2011, 07:30 AM
Hello gergi,

 I think you have missed this part from my response:

"You should get the bound model by requesting the data store (database, repository etc) in your action method. The grid does not serialize its model so there is no way you get it back after postback"

My response remains the same. The grid is not an input element and its data source is not posted to the controller.

Regards,
Atanas Korchev
the Telerik team
Tags
Grid
Asked by
Kapil Koli
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
georges
Top achievements
Rank 1
Share this question
or