...

NavigateURL parameter

yasiraq
08-28-2005, 11:29 PM
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

nikkiH
08-29-2005, 07:54 PM
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.

yasiraq
08-29-2005, 11:47 PM
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

nikkiH
08-30-2005, 02:36 PM
Good to know. I haven't had that problem, but I might run into it. Thanks for posting the solution.

meidianakusuma
04-23-2009, 04:38 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum