ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Call a controller method with a custom grid row Button
Title:
B
I
{code}
?
I need to add a button on each row of a Grid with inline editing, and I need this button to send a post request to a controller action and have the row id (key) as a parameter.
Save Changes
Cancel
c4
asked at 05 Mar 2019
Answers
B
I
{code}
?
you can add a new column for the button: new Column { ClientFormat = "<button type=\"button\" class=\"awe-btn\" onclick=\"call1(.(Id))\">click me</button>" }, and now for the `call1` function you could write a jquery post or use the `InitCall` helper: @Html.Awe().InitCall("callAction1").Url(Url.Action("ActionName")) and the js: function call1(id){ $.when(awe.oc('callAction1', { params: { id: id } })).done(function(res){ console.log('server returned', res); }); }
Save Changes
Cancel
Omu
answered at 05 Mar 2019
Okay, thats just a great example, thank you Sir. Thats how i will do it in the future. `new Column { ClientFormat = "<button type=\"button\" class=\"awe-btn o-glcanb awe-nonselect o-gl o-pad\">Cancel</button> <button type=\"button\" class=\"awe-btn awe-nonselect o-glh o-pad\" onclick=\"ClosePrinter(.(PrinterID))\">Submit</button>", Width = 40 }` :-)
at 05 Mar 2019
c4
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