Using: vs'12 Razor asp.net MVC4 Internet App Template EF Code First
My
Actionlinkthat i am trying to manipulate@Html.ActionLink("Download", "ShowOpenAcreageSummaryReport", new { controller = "DataToExcel" }, new { id = "AddData" })The
scriptto attempt this$('#AddData').click(function (e) { var optVal = $("#OptionsDrop").val(); var Xpro = $("#Prospects").val() var Xcnty = $("#Countys").val() var Xtwn = $("#TownShips").val() var Xrng = $("#Ranges").val() var Xsct = $("#Sections").val() var href = "/DataToExcel/ShowLPRStandardLeaseReport/" + Xpro + Xcnty + Xtwn + Xrng + Xsct; this.href = ""; //clears out old href for reuse this.href = href; //changes href value to currently slected dropdown value}
The
actionResultto accept these passed valuespublic ActionResult ShowLPRStandardLeaseReport(string pro, string cnty, string twn, string rng, string sec)
Now i know this works with 1 variable as i have this code running on another page, however it won't work with multiple.
I have also tried adding + "/" + between the Variables, which had no effect on the outcome.
How can i change my code to be able to pass all variables??
some-url/?param1=test¶m2=test2? Also note thatthispoints to the#AddDataelement in the click handler. If you want to change the current location, usewindow.location.href = 'someurl';+ Xpro + "&" + "cnty=" + Xcnty + "&" + "twn=" + Xtwn + "&" + "rng=" + Xrng + "&" + "sec=" + Xsct;but without the"?"let me add this?, if you could give a short explanation in your answer why that is required that be great and will be accepted thanks.