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 dropdown value to link inside Grid row
Title:
B
I
{code}
?
I am currently using the Grid along with a parent function that allows the user to filter the grid by category. This part works great. @Html.Awe().AjaxRadioList("selEvent").Url(Url.Action("GetEventTypes", "Reliability")).Odropdown().HtmlAttributes(new { style = "min- width:15em;" }) @(Html.Awe().Grid("ReliabilityPartGrid" + ViewData["Id"]) .Url(Url.Action("GetPartialData", "Reliability")) .Columns( .. new Column { Bind = "TestNumber", ClientFormat = "<a href='/Reliability/MakeExcel?testNum=.(TestNumber)'>Link</a>"}, .Parent("selEvent", "EventType")) </div> The AjaxRadioList dropdown "selEvent" works great and filters the Grid correctly. However, I would also like to use the value in that "selEvent" dropdown and pass it through my `<a href>` in the client format "TestNumber" column. How can I access the currently selected item in the "selEvent" dropdown and then pass it as a parameter in the ClientFormat `<a href>` tag ?
Save Changes
Cancel
eliawesome
asked at 16 Jun 2020
Answers
B
I
{code}
?
you can create a js function and call that function in the grid column instead, so your func could look like this: function makeExcel(testNumber){ var selEvent = $('#selEvent').val(); location.href = '@Url.Action("MakeExcel", "Reliability")?selEvent=' + selEvent + '&testNumber='+testNumber; } and the column clientformat something like this: <a href='javascript:makeExcel(.(TestNumber))'>click me</a> you could also use a `button` with `onclick` instead of `a` with `href`
Save Changes
Cancel
Omu
answered at 16 Jun 2020
Awesome, great response and the answer I was needing. Thanks a bunch!!
at 17 Jun 2020
eliawesome
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