473,796 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with hyperlink column in gridview

47 New Member
I have a gridview that has a hyperlink column. It gets the web address from a data source. This is all working as it should. The problem is when I click the web address, it doesn't go to the address. It's like it's trying to find the address locally. I know it probable has something to do with the url formatting, but not sure what needs to be done.

Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="gvEmployeesBenefits" runat="server" DataSourceID="Benefits" Style="z-index: 100;
  2.     left: 0px; top: 0px" AutoGenerateColumns="False" BackColor="White" 
  3.     BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
  4.     GridLines="Horizontal" onrowdatabound="gvEmployeesBenefits_RowDataBound">
  5.     <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
  6.     <Columns>
  7.         <asp:CommandField ShowEditButton="True" />
  8.         <asp:BoundField DataField="BGAN8" HeaderText="Emp#" 
  9.             ReadOnly="True" Visible="False" />
  10.         <asp:BoundField DataField="BGPLAN" HeaderText="Plan" ReadOnly="True" 
  11.             Visible="False" />
  12.         <asp:BoundField DataField="BGAOPT" HeaderText="Option" ReadOnly="True" 
  13.             Visible="False" />
  14.         <asp:BoundField DataField="BAEXA" HeaderText="Plan Description" 
  15.             ReadOnly="True" />
  16.         <asp:BoundField DataField="BGEFT" HeaderText="Enrollment Date" 
  17.             ReadOnly="True" />
  18.         <asp:BoundField DataField="BAFDBA" HeaderText="BAFDBA" ReadOnly="True" 
  19.             Visible="False" />
  20.         <asp:BoundField DataField="BASDBA" HeaderText="BASDBA" ReadOnly="True" 
  21.             Visible="False" />
  22.         <asp:BoundField AccessibleHeaderText="RT" DataField="RT" 
  23.             DataFormatString="{0:N2}" HeaderText="RT" />
  24.         <asp:BoundField DataField="YTD" DataFormatString="{0:N2}" HeaderText="YTD" 
  25.             ReadOnly="True" />
  26.         <asp:HyperLinkField HeaderText="Website" DataNavigateUrlFields="Website" 
  27.             DataTextField="Website" />
  28.     </Columns>
  29.     <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
  30.     <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
  31.     <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
  32.     <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
  33.     <AlternatingRowStyle BackColor="#F7F7F7" />
  34. </asp:GridView>
May 5 '09 #1
9 6323
maliksleo
115 New Member
@kimbred
I think you miss the DataNavigateUrl FormatString part from your hyperlinkField.
use the following code.
Expand|Select|Wrap|Line Numbers
  1. <asp:HyperLinkField HeaderText="Website" DataNavigateUrlFields="Website" 
  2.             DataTextField="Website" DataNavigateUrlFormatString="pagename?variable={0}"/>
maliksleo
May 6 '09 #2
Meganutter
47 New Member
the Gridview tries to locate the website locally unless there is http:// in front of the url, just www. doesnt really work
May 6 '09 #3
balame2004
142 New Member
www should find it out in world wide web.
May 6 '09 #4
Meganutter
47 New Member
i have had occasions where it didnt figure it out, however, one can never be too safe right?
May 6 '09 #5
kimbred
47 New Member
When I put in DataNavigateUrl FormatString="p agename?variabl e={0}" I get the following.

"Illegal characters in path. "
May 6 '09 #6
shiznit770
10 New Member
Can you give an example of a url that is being bound?
May 6 '09 #7
kimbred
47 New Member
WWW.NEX-TECH.COM
If I put the http:// on the front, it works now, but you'd think just the site name would be enough. I'm kind of new to web applications so still learning.
May 6 '09 #8
Meganutter
47 New Member
i had this run in as well a while ago, one of the reasons i think is the parameters in asp like
people can use www. as a prefix for something else as well, hence the http:// (or ftp://) will make it see as an external website.

if you have something in which you can enter the field and store it you can do a check to see whether the user entered http://
May 6 '09 #9
kimbred
47 New Member
Will do. Thanks for your help/
May 6 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2214
by: jib | last post by:
How do I redirect a hyperlink column's URL when the URL doesn't exist? Is it possible to set a default URL for the Hyperlink button? Thanks, Jib
9
15025
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.
3
1326
by: Matthias S. | last post by:
Hi, I've got a DataGrid which is displayed within a CustomerDetails page. The CustomerDetails data (including the data for the grid) is loaded using a QueryString (Item CustomerID) which is passed to this aspx page. The hyperlink column looks like this: <asp:hyperlinkcolumn datanavigateurlfield="ID" datanavigateurlformatstring="AdCampaignDetails.aspx?CampaignID={0}"
2
2260
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
3547
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I can get this to work; however, the column header on the datagrid is not a link/sortable. What am I missing? Thanks in advance.
3
3128
by: William LaMartin | last post by:
I have a gridview (with no properties set) on an aspx page which I populate from an XML file with the code below. The data in the XML file looks like this <description>National Trust for Historic Preservation</description> <URL>http://www.nthp.org/</URL> <category>Architecture</category> Can anyone tell me why the other two columns are displayed, but the
1
13847
by: Frank Milverckowitz | last post by:
Hi, I'm trying to do something common and what should be simple using the GridView "Add Columns" feature in Visual Studio 2005. All I want to do is add a Hyperlink column that will take the user to another aspx page for editing (I'm not using the built in edit feature because I have too many columns)
1
7189
by: Valli | last post by:
Hi, I need to display an hyperlink column in gridview where if the user clicks that column the page should move to the selected page. I have got help from this group & started using template field. After using this, I couldnt see a column supporting hyperlink. In the gridviews first column header, there appears an hyperlink with the first record link displaying. That also only in header overwriting with the first column caption.
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
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
10172
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
10003
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
7546
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
6785
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
5441
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...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
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.