Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Hyperlink simple problem [modified]

Hyperlink simple problem [modified]

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestion
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Yoyosh 0

    Hi, I try to dynamically build URL to navigate: Add new which uses function in my codebehind file: protected string BuildURLAdding() { return @"~/PROTECTED/Annotations/AnnotationsList.aspx?ClientID=" + Request.Params["IDClient"]; } But this is invalid (the link is un-clickable, which means that the 'NavigateUrl' was wrongly specified). Where could be a mistake? I checked the page directive and there is everything ok: <%@ Page Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" Codebehind="AnnotationsList.aspx.cs" Inherits="Mercedes.PROTECTED.Annotations.AnnotationsList" Title="Untitled Page" %> Thank you very much in advance -- modified at 14:30 Monday 21st May, 2007

    G Offline
    G Offline
    Guffa
    wrote on last edited by
    #2

    How do you specify the NavigateUrl? If you paste markup code, use the "Ignore HTML" option.

    --- single minded; short sighted; long gone;

    1 Reply Last reply
    0
    • Y Yoyosh 0

      Hi, I try to dynamically build URL to navigate: Add new which uses function in my codebehind file: protected string BuildURLAdding() { return @"~/PROTECTED/Annotations/AnnotationsList.aspx?ClientID=" + Request.Params["IDClient"]; } But this is invalid (the link is un-clickable, which means that the 'NavigateUrl' was wrongly specified). Where could be a mistake? I checked the page directive and there is everything ok: <%@ Page Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" Codebehind="AnnotationsList.aspx.cs" Inherits="Mercedes.PROTECTED.Annotations.AnnotationsList" Title="Untitled Page" %> Thank you very much in advance -- modified at 14:30 Monday 21st May, 2007

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #3

      You need to resolve the url, not use "~". I assume the BuildURLAdding method is used to assign the NavigateURL property?


      only two letters away from being an asset

      1 Reply Last reply
      0
      • Y Yoyosh 0

        Hi, I try to dynamically build URL to navigate: Add new which uses function in my codebehind file: protected string BuildURLAdding() { return @"~/PROTECTED/Annotations/AnnotationsList.aspx?ClientID=" + Request.Params["IDClient"]; } But this is invalid (the link is un-clickable, which means that the 'NavigateUrl' was wrongly specified). Where could be a mistake? I checked the page directive and there is everything ok: <%@ Page Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" Codebehind="AnnotationsList.aspx.cs" Inherits="Mercedes.PROTECTED.Annotations.AnnotationsList" Title="Untitled Page" %> Thank you very much in advance -- modified at 14:30 Monday 21st May, 2007

        Y Offline
        Y Offline
        Yoyosh 0
        wrote on last edited by
        #4

        I`m terribly sorry - my message wasn`t correctly posted. I have modified it already, this is correct form: Hi, I try to dynamically build URL to navigate: Add new which uses function in my codebehind file: protected string BuildURLAdding() { return @"~/PROTECTED/Annotations/AnnotationsList.aspx?ClientID=" + Request.Params["IDClient"]; } But this is invalid (the link is un-clickable, which means that the 'NavigateUrl' was wrongly specified). Where could be a mistake? I checked the page directive and there is everything ok: <%@ Page Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" Codebehind="AnnotationsList.aspx.cs" Inherits="Mercedes.PROTECTED.Annotations.AnnotationsList" Title="Untitled Page" %> Thank you very much in advance

        N 1 Reply Last reply
        0
        • Y Yoyosh 0

          I`m terribly sorry - my message wasn`t correctly posted. I have modified it already, this is correct form: Hi, I try to dynamically build URL to navigate: Add new which uses function in my codebehind file: protected string BuildURLAdding() { return @"~/PROTECTED/Annotations/AnnotationsList.aspx?ClientID=" + Request.Params["IDClient"]; } But this is invalid (the link is un-clickable, which means that the 'NavigateUrl' was wrongly specified). Where could be a mistake? I checked the page directive and there is everything ok: <%@ Page Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" Codebehind="AnnotationsList.aspx.cs" Inherits="Mercedes.PROTECTED.Annotations.AnnotationsList" Title="Untitled Page" %> Thank you very much in advance

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #5

          Same reponse, resolve the URL, don't use ~ http://msdn2.microsoft.com/en-us/library/system.web.ui.control.resolveurl.aspx[^]


          only two letters away from being an asset

          Y 1 Reply Last reply
          0
          • N Not Active

            Same reponse, resolve the URL, don't use ~ http://msdn2.microsoft.com/en-us/library/system.web.ui.control.resolveurl.aspx[^]


            only two letters away from being an asset

            Y Offline
            Y Offline
            Yoyosh 0
            wrote on last edited by
            #6

            I`m affraid that this is not the problem here. First of all, I have a working example with '~' in front of address. Second of all - I deleted this from my example and it still doesn`t work. Any more suggestions?

            N 1 Reply Last reply
            0
            • Y Yoyosh 0

              I`m affraid that this is not the problem here. First of all, I have a working example with '~' in front of address. Second of all - I deleted this from my example and it still doesn`t work. Any more suggestions?

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #7

              Are you referring to this MasterPageFile="~/SiteMaster.Master" as your example. If so it is an apples to oranges comparison, they are not the same thing. The tilda is resolved via the control.ResolveURL method. You are manually providing the url string which does not go through this method.


              only two letters away from being an asset

              Y 1 Reply Last reply
              0
              • N Not Active

                Are you referring to this MasterPageFile="~/SiteMaster.Master" as your example. If so it is an apples to oranges comparison, they are not the same thing. The tilda is resolved via the control.ResolveURL method. You are manually providing the url string which does not go through this method.


                only two letters away from being an asset

                Y Offline
                Y Offline
                Yoyosh 0
                wrote on last edited by
                #8

                I don`t understand everything you wrote, but even if I try with that method in my .cs file: protected string BuildURLAdding() { string s = "www.onet.pl"; return s; } the hiperlink still remains invisible

                N 1 Reply Last reply
                0
                • Y Yoyosh 0

                  I don`t understand everything you wrote, but even if I try with that method in my .cs file: protected string BuildURLAdding() { string s = "www.onet.pl"; return s; } the hiperlink still remains invisible

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #9

                  Perhaps I missed it at the begining, you are using <%# BuildURL() %> which a databinding expression. Have you tried using <% =BuildURL() %>


                  only two letters away from being an asset

                  Y 1 Reply Last reply
                  0
                  • N Not Active

                    Perhaps I missed it at the begining, you are using <%# BuildURL() %> which a databinding expression. Have you tried using <% =BuildURL() %>


                    only two letters away from being an asset

                    Y Offline
                    Y Offline
                    Yoyosh 0
                    wrote on last edited by
                    #10

                    I tried using <% =BuildURL() %> and <% BuildURL() %> the effect is different - I can now see the link and even click it, but after clicking I`m getting: HTTP Error 400 - Bad Request. - I believe the navigateUrl is not being set correctly I`m coping here the working example that I`m having: <asp:HyperLink ID="Link1" runat="server" NavigateUrl='<%# BuildURLForCustomer(Eval("ID"), Eval("Moves")) %>'> protected string BuildURLForCustomer(object ob1, object ob2) { string pageName = "~/Cars/CarsList.aspx"; return string.Format("{0}?id={1}", ob1, ob2); }

                    Y 1 Reply Last reply
                    0
                    • Y Yoyosh 0

                      I tried using <% =BuildURL() %> and <% BuildURL() %> the effect is different - I can now see the link and even click it, but after clicking I`m getting: HTTP Error 400 - Bad Request. - I believe the navigateUrl is not being set correctly I`m coping here the working example that I`m having: <asp:HyperLink ID="Link1" runat="server" NavigateUrl='<%# BuildURLForCustomer(Eval("ID"), Eval("Moves")) %>'> protected string BuildURLForCustomer(object ob1, object ob2) { string pageName = "~/Cars/CarsList.aspx"; return string.Format("{0}?id={1}", ob1, ob2); }

                      Y Offline
                      Y Offline
                      Yoyosh 0
                      wrote on last edited by
                      #11

                      It is very interesting, why this example doesn`t work in my current project. I took it from other project where it worked... Nevertheless, I can of course set these NagivateUrls in Load(..) method, but it`s still very interesting why this doesn`t work

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups