Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hyperlink Column & Helper Function not working

Reply
Thread Tools

Hyperlink Column & Helper Function not working

 
 
D. Shane Fowlkes
Guest
Posts: n/a
 
      11-19-2004
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>






 
Reply With Quote
 
 
 
 
=?Utf-8?B?RU5JWklO?=
Guest
Posts: n/a
 
      11-19-2004
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>
>
>
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
What's the purpose of the helper cache and is there a way to just turn off helper cache-ing? kevin Ruby 1 07-21-2006 03:42 AM
HyperLink Column and Button Column in a DataGrid =?Utf-8?B?V2FyYW4=?= ASP .Net 0 08-09-2005 12:00 AM
Helper function inside template column Chris ASP .Net Datagrid Control 1 11-25-2003 08:51 AM



Advertisments