473,659 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hyperlink Column & Helper Function not working

Hello All.

I keep asking for help with this on the www.asp.net forums and nobody seems
to be able to help. What I'm trying to accomplish is very simple. I simply
want to create a Hyperlink Column in a Datagrid and reformat the text output
of the column. The helper function seems to be working but the hyperlink
column isn't properly being render into html. The actual hyperlink web
control is showing up in the html when tested on two unique servers.

I'd be grateful if someone here could help! Thanks!
-Shane Fowlkes

Test Page: http://www.vrmca.com/membership/producers.aspx

My Code:
*************** *************** *************** ******
Function EncryptSpaces(C ompany As String) As String
Company = Replace(Company ," ","%20")
Return Company
End Function

....etc.....

<form runat="server">
<asp:datagrid id="dgProducers " runat="server"
HorizontalAlign ="Center"
...etc.....
Width="90%">

<columns>
<asp:TemplateCo lumn HeaderText="Com pany">
<ItemTemplate >
<asp:HyperLin k NavigateUrl ='<%# "memdetails.asp x?org=" &
EncryptSpaces(C ontainer.DataIt em("Company")) %>'>
<%# Container.DataI tem("Company") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:BoundColum n HeaderText="# of Members" DataField="Coun tOfMember" />
</columns>
</asp:datagrid>
</form>

*************** *************** ****

And the HTML comes out like.....
<td>
<asp:HyperLin k NavigateUrl
='memdetails.as px?org=Hard%20R ock%20Concrete% 20LLC'> Hard Rock Concrete
LLC</asp:HyperLink>
</td>


Nov 18 '05 #1
1 1854
I've seen this many times before and what I do is create a function to return
my complete URL.

Function EncryptSpaces(C ompany As String) As String
Return Server.UrlEncod e("memdetails.a spx?org=" & Company)
End Function

<ItemTemplate >
<asp:HyperLin k NavigateUrl ='<%#
EncryptSpaces(C ontainer.DataIt em("Company")) %>'>
<%# Container.DataI tem("Company") %>
</asp:HyperLink>
</ItemTemplate>

HTH
"D. Shane Fowlkes" wrote:
Hello All.

I keep asking for help with this on the www.asp.net forums and nobody seems
to be able to help. What I'm trying to accomplish is very simple. I simply
want to create a Hyperlink Column in a Datagrid and reformat the text output
of the column. The helper function seems to be working but the hyperlink
column isn't properly being render into html. The actual hyperlink web
control is showing up in the html when tested on two unique servers.

I'd be grateful if someone here could help! Thanks!
-Shane Fowlkes

Test Page: http://www.vrmca.com/membership/producers.aspx

My Code:
*************** *************** *************** ******
Function EncryptSpaces(C ompany As String) As String
Company = Replace(Company ," ","%20")
Return Company
End Function

....etc.....

<form runat="server">
<asp:datagrid id="dgProducers " runat="server"
HorizontalAlign ="Center"
...etc.....
Width="90%">

<columns>
<asp:TemplateCo lumn HeaderText="Com pany">
<ItemTemplate >
<asp:HyperLin k NavigateUrl ='<%# "memdetails.asp x?org=" &
EncryptSpaces(C ontainer.DataIt em("Company")) %>'>
<%# Container.DataI tem("Company") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:BoundColum n HeaderText="# of Members" DataField="Coun tOfMember" />
</columns>
</asp:datagrid>
</form>

*************** *************** ****

And the HTML comes out like.....
<td>
<asp:HyperLin k NavigateUrl
='memdetails.as px?org=Hard%20R ock%20Concrete% 20LLC'> Hard Rock Concrete
LLC</asp:HyperLink>
</td>


Nov 18 '05 #2

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

Similar topics

1
1769
by: YSRao | last post by:
Dear Friends I would like to know how to assign some parameter and values to the url in a datagrid hyperlink column.. i have datagrid with 5 items and i made the column as hyperlinkcolumn and here i want to pass some parameters and values to the next page along with the url. can any one help me out this problem please. i will Appreciate your help
5
6685
by: Martin Dew | last post by:
Having some problems getting a hyperlink object to work in my repeater control, It displays the text I have asked it to for the hyperlink, but it does not act as a link. My repeater code is below but here is the snippet of my asp:hyperlink object; <asp:HyperLink NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(Conta iner.DataItem,"CLIENTREF")%> ID="Hyperlink1"><%#DataBinder.Eval(Container.DataItem,...
9
15011
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring = datagrid.Items(rownumber).Cells.Item(column number).Text returns a blank string. It seems to work ok for the other columns that are just regular datagrid columns, not hyperlink types. Thanks. -- Paul G Software engineer.
4
4216
by: Tomek R. | last post by:
Hello ! This post does'nt regard column hyperlink. I just have single hyperlink and want to create it's NavigateUrl dynamically. This is my test page <form id="Form1" method="post" runat="server"> <asp:HyperLink id="MyHLink" NavigateUrl='<%# geturl("123456") %>'
3
15406
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub createTable() Dim tbcontacts As DataTable = New DataTable("contacts") tbcontacts.Columns.Add(" ", System.Type.GetType("System.String"))
0
1256
by: Waran | last post by:
Hi, In a datagrid I am displaying 2 columns. One is a Hyperlink Colum and the other is a Button Column. The values for the hyperlink columns are fetched from the database and its a url. When I click the Download button I am taking the URL value from the Hyperlink column (using CType(E.Item.Cells(0).Controls(0), HyperLink).NavigateUrl ).I am doing some validations on this Button Click event.Its working fine. Now I need to perform the...
19
3481
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred to here as page_2). I need to cache the value of the link's text (hyperlink.text property) so that I can use it in the page_load event of page_2. I've thought of using a hidden field and then calling Request.Form("hdnClickedLinkText") in the...
3
4164
by: Bren | last post by:
Hi All VS2005 Gridview control with vb I am populating a gridview of company staff. One of the columns is a hyperlink to a SMS texting facility I have so secrataries can text the managers etc. i.e Secratary loads the page on the intranet, finds the manager they want to contact, clicks on the "SMS" hyperlink and is taken to the SMS page to fill out the message and send it to the manager.
0
5558
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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
8746
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
8525
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,...
1
6179
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
5649
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
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.