for view:-
here op is my selected value from html dropdown & e is value of a button click..
i just want to pass both two values to my controller from where i can put those in my sql query. how i can pass those two variable in my @UrlAction so i can get those in mycontroller
function details()
{
var op;
var e = document.getElementById("test").Value;
$("mydropdown option").each(function (i) {
var op = $(this).attr('selected').val();
})
window.open('@UrlAction("UserLayerView", "home", new {layertype = e, layername= op })')
}
for controller:-
public ActionResult UserLyerView(DataTable as dt, String layertype, String layername)
{
string query = "select column name from" + layertype + "Where name =" +layername;
}
UrlActionwork? (and: shouldn't that beUrl.Action(...)?) does it give the right result? what happens when the window.open fires? basically: in what way do your expectation and reality differ?Url.Action(...)instead ofUrlAction(...)?name and 1=0; drop table users; --Url.Action- it should be using query string like this:window.open('@Url.Action("UserLayerView", "Home")' + '?layertype=' + e + '&layername=' + op).