473,466 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Create 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(Company 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:TemplateColumn HeaderText="Company">
<ItemTemplate>
<asp:HyperLink NavigateUrl ='<%# "memdetails.aspx?org=" &
EncryptSpaces(Container.DataItem("Company")) %>'>
<%# Container.DataItem("Company") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="# of Members" DataField="CountOfMember" />
</columns>
</asp:datagrid>
</form>

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

And the HTML comes out like.....
<td>
<asp:HyperLink NavigateUrl
='memdetails.aspx?org=Hard%20Rock%20Concrete%20LLC '> Hard Rock Concrete
LLC</asp:HyperLink>
</td>


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

Function EncryptSpaces(Company As String) As String
Return Server.UrlEncode("memdetails.aspx?org=" & Company)
End Function

<ItemTemplate>
<asp:HyperLink NavigateUrl ='<%#
EncryptSpaces(Container.DataItem("Company")) %>'>
<%# Container.DataItem("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(Company 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:TemplateColumn HeaderText="Company">
<ItemTemplate>
<asp:HyperLink NavigateUrl ='<%# "memdetails.aspx?org=" &
EncryptSpaces(Container.DataItem("Company")) %>'>
<%# Container.DataItem("Company") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="# of Members" DataField="CountOfMember" />
</columns>
</asp:datagrid>
</form>

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

And the HTML comes out like.....
<td>
<asp:HyperLink NavigateUrl
='memdetails.aspx?org=Hard%20Rock%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
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...
5
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...
9
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 =...
4
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"...
3
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...
0
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...
19
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...
3
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...
0
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...
0
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 ...

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.