1

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?

2 Answers 2

1

You use the & to seperate multiple query string cars. For example, Foo=12&first=death

Sign up to request clarification or add additional context in comments.

1 Comment

i have used it in the above query string. Is it like this ---Regno= <%#Eval ("ID") %>'+ ","'&Fn=<%#Eval ("FIRSTNAME") %>'---
0

("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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.