473,789 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

undesired behavior in setting hyperlink .NavigateURL property


in the codebehind portion of a page, I dynamically create a series of
hyperlinks that I add to the page.

in that code, I have something like this:

dim h as new hyperlink

h.NavigateURL = "/somepage.aspx?a ge=35&gender=M"
Unfortunately, when it renders the HTML page, it changes the ampersand in
the URL as follows

h.NavigateURL = "/somepage.aspx?a ge=35&gende r=M"
This, of course, doesn't work, because the 2nd parameter's name has now been
changed from 'gender' to 'amp;gender'
How can I get around this?
(I tried setting the 'href' attribute directly ...
h.attributes.ad d("href","/somepage.aspx?a ge=35&gender=M" ) ... but it
produces the same result)


Nov 17 '05 #1
3 1932
you might look into HttpUtility.Htm lEncode("yourte xt")

"Boban Dragojlovic" <news@_N_O_S_P_ AM_dragojlovic. org> wrote in message
news:MX******** *******@newssvr 14.news.prodigy .com...

in the codebehind portion of a page, I dynamically create a series of
hyperlinks that I add to the page.

in that code, I have something like this:

dim h as new hyperlink

h.NavigateURL = "/somepage.aspx?a ge=35&gender=M"
Unfortunately, when it renders the HTML page, it changes the ampersand in
the URL as follows

h.NavigateURL = "/somepage.aspx?a ge=35&amp;gende r=M"
This, of course, doesn't work, because the 2nd parameter's name has now been changed from 'gender' to 'amp;gender'
How can I get around this?
(I tried setting the 'href' attribute directly ...
h.attributes.ad d("href","/somepage.aspx?a ge=35&gender=M" ) ... but it
produces the same result)

Nov 17 '05 #2
I am sorry I meant httputility.htm ldecode("yourte xt")

"vMike" <Mi************ @nospam.gewarre n.com.delete> wrote in message
news:bn******** **@ngspool-d02.news.aol.co m...
you might look into HttpUtility.Htm lEncode("yourte xt")

"Boban Dragojlovic" <news@_N_O_S_P_ AM_dragojlovic. org> wrote in message
news:MX******** *******@newssvr 14.news.prodigy .com...

in the codebehind portion of a page, I dynamically create a series of
hyperlinks that I add to the page.

in that code, I have something like this:

dim h as new hyperlink

h.NavigateURL = "/somepage.aspx?a ge=35&gender=M"
Unfortunately, when it renders the HTML page, it changes the ampersand in the URL as follows

h.NavigateURL = "/somepage.aspx?a ge=35&amp;gende r=M"
This, of course, doesn't work, because the 2nd parameter's name has now

been
changed from 'gender' to 'amp;gender'
How can I get around this?
(I tried setting the 'href' attribute directly ...
h.attributes.ad d("href","/somepage.aspx?a ge=35&gender=M" ) ... but it
produces the same result)


Nov 17 '05 #3
One more comment, the &amp; should not effect the url query string. It
should still work the same.
"Boban Dragojlovic" <news@_N_O_S_P_ AM_dragojlovic. org> wrote in message
news:MX******** *******@newssvr 14.news.prodigy .com...

in the codebehind portion of a page, I dynamically create a series of
hyperlinks that I add to the page.

in that code, I have something like this:

dim h as new hyperlink

h.NavigateURL = "/somepage.aspx?a ge=35&gender=M"
Unfortunately, when it renders the HTML page, it changes the ampersand in
the URL as follows

h.NavigateURL = "/somepage.aspx?a ge=35&amp;gende r=M"
This, of course, doesn't work, because the 2nd parameter's name has now been changed from 'gender' to 'amp;gender'
How can I get around this?
(I tried setting the 'href' attribute directly ...
h.attributes.ad d("href","/somepage.aspx?a ge=35&gender=M" ) ... but it
produces the same result)

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1102
by: Nielsen | last post by:
Hi Question regarding Content Management Server and C# string survey = thisPosting.Placeholders.Datasource.RawContent.ToString() Label1.Text = survey Label1 shows correctly the value: http://www.thisURL.com. EI the value of the Placeholder called "SurveyLink This is ok
4
8955
by: Amir Eshterayeh | last post by:
Dear Friends My asp hyperlink goes to relative address instead of absolute. I like navigate url goes to outsite link like www.asp.net but now, it goes to www.mysite/www.asp.net please help. I create the navigatURL from database dynamically. I see the same question mentioned here but the response is not souitable for me: http://www.dotnet247.com/247reference/msgs/11/57708.aspx
0
550
by: Ryan Harvey | last post by:
Hi all, I have written a web user control that contains a repeater control. the ItemTemplate for this control is basically 6 Hyperlinks in a row, that are dynamically allocated one of 7 gif images as the ImageURL of the Hyperlink. When a load the page with the controls on it works fine, but sometimes the images are broken, but if i hit refresh i get random selections of the gifs appearing and not appearing. if i hit Back button to a page...
2
2259
by: Jason | last post by:
I have a data grid with a hyperlink column. The hyperlink is created by a class that extracts the link from an XML Document. How can I populate the hyperlink column in the data grid with the value (link) returned from my class method? I have to send the company ticker to the class in order to get the correct link. I tried embedding the method into the NavigateURL property of the data grid (i.e. NavigateUrl="GetCompanyLink(Ticker)")...
10
1946
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign a column of URLs to this hyperlink column in programming way (ie., dynamically assignment). However, I can not find a way to continue doing it. Do you have ideas about it? Thanks.
3
3408
by: VB Programmer | last post by:
I have a datalist with a hyperlink in the Item Template. When I set the NavigateUrl simply to this, the databound CategoryId shows up fine: <asp:HyperLink id=hlLink runat="server" NavigateUrl='<%#Container.DataItem("CategoryId")%>'> <%# Container.DataItem("CategoryName") %> </asp:HyperLink>&nbsp;
2
2437
by: Andy | last post by:
Hi, This is one of those things I thought should e easy... I'm programatically trying to set the navigateURL property in a hyperlink in the headertemplate of a repeater, but always get the following error "Object reference not set to an instance of an object." when referencing the hypermink in the following line.. hypAuthors.NavigateUrl = "http://www.microsoft.com"
8
11255
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the HyperLinkField I have problems with: <asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}" HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />
2
2814
by: BobLaughland | last post by:
Hi There, I need a control on my site that is a hyperlink style control, but it must, 1) Have a property that can hold where the hyperlink is pointing to. (e.g. like the NavigateUrl property in the asp:hyperlink control). 2) Also can call my own method when the user clicks on the link (e.g. like the Click event in the asp:linkbutton control).
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.