Helpful Information
 
 
Category: ASP.NET
NavigateURL parameter

Hi,

I am having problem in implementing this code:

<asp:hyperlink navigateURL='file.aspx?id=<%=session("id")%>' runat=server>Link Text</asp:hyperlink>

To avoid the nested quotes bug of .net, I have placed single quote around the navigateURL parameter but now this parameter is being treated as String, that is, it is not executing the <%=session("id")%> part and just showing it as a string.

Is there anyone to help me out?

Thanks
Yasir

I use hyperlink column fine with embedded quotes with csharp like so:

<asp:HyperLink id=HyperLink1
runat="server"
Font-Size="Smaller"
ForeColor="#0000CC"
Font-Names="verdana"
NavigateUrl='<%# "?categoryid=" + DataBinder.Eval(Container.DataItem,"report_category_id") + "&amp;office=" + Request.QueryString["office"] %>'>
<%# DataBinder.Eval(Container.DataItem,"report_category_name") %>
</asp:HyperLink>

So, change the plus signs to ampersands (and the pound sign out?) if you're using VB.

It does work fine with databind expression but not for other executable scripts like <%=session("id")%>

But Finally, I got it fixed after working on it for almost 24hrs !!!!!

THe solution is as follows:

<script language="VB" runat="server">

Sub Page_Load(Source As Object, E As EventArgs) Handles MyBase.Load

link.NavigateURL = "logout.aspx?id=" & Session("id")

End Sub

</script>

And the control was like this:

<asp:HyperLink ID="link" Runat="server" >Testing</asp:HyperLink>


I hope this will benefit some other people (like me) as well.

Also, does anybody know that this nested quotes bug has been fixed in 2.0 or not?

Thanks

Good to know. I haven't had that problem, but I might run into it. Thanks for posting the solution.

hii, i want to ask something related to this,
how if i want send this hyperlink to someone's email

let say that it is link to change password,
i can create this parameter in the website, but i became confuse when i want to send this hyperlink to the user










privacy (GDPR)