Hyperlink simple problem [modified]
-
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
-
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
-
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
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
-
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
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
-
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
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
-
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
-
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?
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
-
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
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
-
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
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
-
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
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); }
-
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); }