user576510
user576510

Reputation: 5905

how to use Request.QueryString in aspx page?

In aspx page I have anchor tags. My URL already has Id parameter which I want to reuse. Requirement is to redirect user to a mentioned page with current url id e.g.

"~/Dir/Home?Id=" & Request.QueryString

Please note I have to do this in aspx page as cant use code behind pages.

Thanks a lot

Upvotes: 3

Views: 26039

Answers (4)

user8159950
user8159950

Reputation: 11

try this

href="contact_list.aspx?xid=<%= Request.QueryString["xeroID"].ToString()%>"

Upvotes: 0

Redder
Redder

Reputation: 11

The easyest way is to add a name attribute to the iframe tag:

<iframe runat="server" id="frameid" name="framename" src="anypage.aspx"></iframe>

and then add this on the page_load event:

framename.Attributes.Item("src") = "thepage.aspx?id=" & Request.querystring("id")

Easy, clean and in VBNET no JavaScript needed.

Upvotes: 0

Adil
Adil

Reputation: 148120

You can use scriptlets

'~/Dir/Home?Id=<%= Convert.ToString(Request.QueryString["ID"]) %>';

You can learn more about using QueryString here

Upvotes: 8

शेखर
शेखर

Reputation: 17614

I think you can use like this

'~/Dir/Home?Id=<%Request.QueryString.Get("ID")??""%>'

Similar question on SO
how to retrieve a querystring value from an .aspx page and pass it to ascx page
http://forums.asp.net/t/1655117.aspx

Upvotes: 3

Related Questions