Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    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.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Good to know. I haven't had that problem, but I might run into it. Thanks for posting the solution.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    New to the CF scene
    Join Date
    Jan 2009
    Location
    indonesia
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •