Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVCContrib grid and posting back with model binder

The contents of my MVCContrib grid come from the Model on a strongly typed View. When a post is made, the contents of the grid are not in the model object when it returns to the controller. I can see that this is because the grid renders as just a table with text in cells. Is there something I can do so that when the post occurs, the list data I sent down to the grid comes back in the post?

like image 358
jlembke Avatar asked Nov 22 '25 01:11

jlembke


1 Answers

You can use TempData to persist this information server side. The information in TempData will persist for one request. I do not really like this option however.

Can you not repopulate your model from the db? If the user is not changing the information why do you need to post back all the same unchanged information? Just grab it again from where you got it before.

like image 144
redsquare Avatar answered Nov 23 '25 15:11

redsquare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!