Hi! I want to retrieve the query string from the url (Eg: http://localhost:2106/CustomerView.aspx?EmployeeID=2 ) and append it to the a href statement. I have tried:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If (Not Me.IsPostBack) AndAlso (Request("EmployeeID") IsNot Nothing) Then
HyperLink1.NavigateUrl = String.Concat("CustomerInsert.aspx?EmployeeID=", Request("EmployeeID"))
End If
End Sub
firblazer
Member
1 Points
10 Posts
Request.QueryString with <a href...> problem
Jun 19, 2008 02:26 PM|LINK
Hi! I want to retrieve the query string from the url (Eg: http://localhost:2106/CustomerView.aspx?EmployeeID=2 ) and append it to the a href statement. I have tried:
<a href="CustomerInsert.aspx?EmployeeID=" + Request.QueryString("EmployeeID")>Click here</a>But it doesn't work. Please help. Thanks.
keyboardcowb...
Contributor
5539 Points
1045 Posts
Re: Request.QueryString with <a href...> problem
Jun 19, 2008 02:29 PM|LINK
try
<a href="CustomerInsert.aspx?EmployeeID=" + <%Request.QueryString("EmployeeID") %>>Click here</a>
ramblor
Contributor
6676 Points
1013 Posts
Re: Request.QueryString with <a href...> problem
Jun 19, 2008 02:31 PM|LINK
Try this in the aspx page:
<a href="CustomerInsert.aspx?EmployeeID=<%=Request.QueryString("EmployeeID")%>">Click here</a>ecbruck
All-Star
98783 Points
9691 Posts
Moderator
Re: Request.QueryString with <a href...> problem
Jun 19, 2008 02:34 PM|LINK
Or set it in the code-behind:
ASPX
<
asp:hyperlink id="HyperLink1" runat="server" text="Click here" />CODE-BEHIND
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack && (Request["EmployeeID"] != null)) { HyperLink1.NavigateUrl = String.Concat("CustomerInsert.aspx?EmployeeID=", Request["EmployeeID"]); } }Microsoft MVP - ASP.NET
firblazer
Member
1 Points
10 Posts
Re: Request.QueryString with <a href...> problem
Jun 19, 2008 03:05 PM|LINK
Sorry, could you code the code-behind in VB language? Thanks.
ecbruck
All-Star
98783 Points
9691 Posts
Moderator
Re: Request.QueryString with <a href...> problem
Jun 19, 2008 03:24 PM|LINK
How about this?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If (Not Me.IsPostBack) AndAlso (Request("EmployeeID") IsNot Nothing) Then HyperLink1.NavigateUrl = String.Concat("CustomerInsert.aspx?EmployeeID=", Request("EmployeeID")) End If End SubMicrosoft MVP - ASP.NET