Thursday, March 29, 2012

Pass parameters through a hyperlink?

Is it possible to pass parameters through a hyperlink?

For Instance -- HTTP://WWW.MYDOMAIN.COM/PAGE.ASPX?VARIABLE=ABCD

And then if I reference VARIABLE in code, it will be equal to ABCD? If this is not possible directly as I described above, how can it be possible, because I need to somehow pass variables/parameters through a hyperlink.

I know about Session("") already, and that can pass data between pages, I know, but I need to do it through a hyperlink somehow.

Thanks.Sure, you can access it via the QueryString property of the Request object:


string var = Request.QueryString["VARIABLE"];

The string var now has the value of "ABCD".
Thanks a million, works great! :)

Hello

I need to pass parameter through a hyperlink but I don't know how to do this.

I try this in HTML

NavigateUrl="javascript:popup('AddNewContact.aspx?text="+BrokerName+"&BrokerKey="+BrokerID+"',500,700)

It did work.

Can you help me?

THanks,


Guarumal,

What you are doing is different than the original post. His is a static URL and you are building a dynamic URL. This should be a new thread.

My first question is, are BrokerName and BrokerKey VB/C# variables or javascript variables? The most likely situation is that you are trying to build the NavigateURL property in the wrong place. If those are VB/C# variables you need to do this in the code behind page.

0 comments:

Post a Comment