ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
How to pass params to controller Inline Grid
Title:
B
I
{code}
?
Please advise how to pass some params(hidden field values) to controller while Get, Create, Edit and Delete operations.Thanks. @(Html.Awe().Grid("DinnersGrid") .Mod(o => o.PageInfo().InlineEdit(Url.Action("Create"), Url.Action("Edit"))) .Url(Url.Action("GridGetItems"))
Save Changes
Cancel
samp
asked at 19 Feb 2016
you have the id on the server side so you can get the rest by id, also on edit you get all the hidden columns values, delete is the same as for all the other crud demos, and for create you already have a create with predefined values button in the demo ( so it's the same as edit )
at 19 Feb 2016
Omu
I want to pass some other value which isn't related the Grid data. How can we pass? Thanks.
at 19 Feb 2016
samp
could you please give more details
at 20 Feb 2016
Omu
we have some hidden fields values(logged in user info and some other fields) which are not related to the Grid. It would be great helpful if we have an option to pass those params while performing CRUD operations.
at 22 Feb 2016
samp
and where do you need them ? (edit and create POST actions) or do you need these values to affect the initial Create/Edit row ( when the user clicks on Create/Edit button )
at 22 Feb 2016
Omu
I need them while GET, EDIT, CREATE and Delete operations.
at 22 Feb 2016
samp
I understand that, my question is how are they being used, where are you using these values, when you save an item in the Db for example, or when you get it and use the value to alter the data, please enumerate
at 22 Feb 2016
Omu
Need those values in controller while getting or updating data.
at 22 Feb 2016
samp
you can use Html.Awe().Grid() .Parent (if the value changes) or .Parameter or .ParameterFunc to bind or set those values, this way you'll have them when getting the data, you can also pass them to the MapToGridModel method (not sure how you use those values); Delete is done using InitPopupForm which also has .Parent and .Parameter, and for the Create you have the predefined values demo button
at 22 Feb 2016
Omu
Can you provide an example or sample code please?
at 22 Feb 2016
samp
.Parent("hidtestid", "testid") .Parent("hiduserid", "hiduserid"). Controller: public ActionResult GridGetTestResultsItems(GridParams g, string search, string hiduserid, string testid) { } I am trying to pass hidden field values like this. Please suggest how can I pass?
at 23 Feb 2016
samp
well you have them in the grid action now, and that's where the grid model is created (the initial data for the edit), can't tell much else, I don't know how you're supposed to use these additional values
at 23 Feb 2016
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK