create querystring with parameters in aspx using jquery vars
Hi,
I'm trying to create a querystring in my aspx page. I need to pass in 2 variables as parameters. The end goal is something like this:
Popup.aspx?paramOne={0}¶mTwo={1}
I have a function that needs this string.
$("#<%=FindButton.ClientID %>").click(function() {
var paramOne = $("#<%=ParamOneDDL.ClientID %>").eq(0).val();
var paramTwo = $("#<%=ParamTwoDDL.ClientID %>").eq(0).val();
var queryString ='<%= string.Format(Constants.MyPopupQuerystring, paramOne, paramTwo) %>';
MyFunc(queryString);
return false;
});
That doesn't work. It doesn't recognise paramOne and paramTwo with that syntax, so i tried to use the DDL.SelectedValue directly and that doesn't work either as it doesn't find a value for some reason.
I can manually set up the string as follows:
queryString = "MyPopup.aspx?paramOne=" + paramOne + "¶mTwo=" + paramTwo);
which works but is not good coding practice as I don't want to hard code stuff.
What is the correct notation to do this?