Saturday, March 24, 2012

Pass variable to URL string

In ASP.NET, the HTML code, I have the following lines to pass variable MyType to the URL parameter:
<P><a id="aHome" runat="Server" class="nav"href="Main.aspx?HeaderType=<%= headertype%>">Home</a></P>
In my Main.aspx page, when I query the string as:Request.QueryString("HeaderType"), it always return me "<%=headertype %>", but not the value of variable: headertype.
How can I pass a variable value to URL string parameter.
Thanks.

You can use :

Response.Redirect("newPage.aspx?value="+TextBox1.Text);

Let me know if you need this to work when the hyperlink is clicked.

Hope this helps !


Thanksfor your answer, it works,
If you can tell me how to pass it to URL string, it will be very helpfull. Hyperlilnk does not have click event.

0 comments:

Post a Comment