Reputation: 535
I tried to pass more than one value through Query String from page1.aspx to page2.aspx.
This is my Query string in the Grid View
<a href="javascript:void(0);" onclick='javascript:window.open("Update.aspx?Regno= <%#Eval ("ID") %>'+ ","'&Fn=<%#Eval ("FIRSTNAME") %>' +", "'&Ln=<%#Eval ("LASTNAME") %>'")';>
Edit</a>
On My Page2.aspx, my code behind on PageLoad is:
if (Page.IsPostBack) return;
string id = Request.QueryString["ID"];
string Firstname = Request.QueryString["FIRSTNAME"];
string LastName = Request.QueryString["LASTNAME"];
My Visual Studio IDE shows a syntax error on this query string. I dont know the exact way to pass multiple values through Query String. How to make it work? Can anyone pls help me on this..
Which is the right syntax to pass multiple query string?
Upvotes: 1
Views: 6490
Reputation: 3880
("LASTNAME") %>'")'
;
Whats up with the semicolon here at the end??? try removing that as u dont need it
Also You string is a bit difficult to find any missing , quotes. Better print in console , or give an alert for this
Update.aspx?Regno= <%#Eval ("ID") %>'+ ","'&Fn=<%#Eval ("FIRSTNAME") %>' +", "'&Ln=<%#Eval ("LASTNAME") %>'")';
And copy the printed string, paste it in the Browser and check whether it works! There by u can see what are all the things getting passed and where you made mistake in syntax
Upvotes: 0
Reputation: 8018
You use the & to seperate multiple query string cars. For example, Foo=12&first=death
Upvotes: 1