473,666 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display an hyperlink column in gridview using TemplateField

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.

can anyone help me in this..

My code follows here...

<asp:TemplateFi eld>
<ItemTemplate >

<asp:HyperLin k ID="HyperLink2 " runat="server" NavigateUrl='<% #
Eval("FileLink" ) %>'

Style="z-index: 100; left: 0px; position: absolute; top: 0px" Text='<%#
Eval("FileLink" ) %>'></asp:HyperLink>

</ItemTemplate>
</asp:TemplateFie ld>

--FileLink is the datafield name which provides the link
--
Thanks & Regards
Valli
Sep 27 '07 #1
1 7161
<asp:XmlDataSou rce ID="XmlDataSour ce1" runat="server">
<Data>
<Links>
<Link FileLink="http://www.microsoft.c om"/>
<Link FileLink="http://msdn.microsoft. com"/>
<Link FileLink="http://technet.microso ft.com"/>
</Links>
</Data>
</asp:XmlDataSour ce>

is the source for

<asp:GridView ID="GridView1" runat="server" DataSourceID="X mlDataSource1">
<Columns>
<asp:HyperLinkF ield
DataNavigateUrl Fields="FileLin k"
DataTextField=" FileLink"/>
</Columns>
</asp:GridView>

and

<asp:GridView ID="GridView2" runat="server" DataSourceID="X mlDataSource1">
<Columns>
<asp:TemplateFi eld>
<ItemTemplate >
<asp:HyperLin k ID="HyperLink1 " runat="server"
Text='<%# Eval("FileLink" ) %>'
NavigateUrl='<% # Eval("FileLink" ) %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>

We could help you, and others, better if you post more of your code rather
than just posting a TemplateField. At least then when someone copies and
pastes the code into a new ASPX page it'll produce a result.

Sep 28 '07 #2

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

Similar topics

3
6842
by: Wayne Wengert | last post by:
I am trying to impliment the extensions to the Club Starter kit as described at: http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/extendclubwebsitesk.asp but when I build the hyperlinks in the Gridview Column template as described at the end of the article I am getting two errors on each of the hyperlinks ("Characer is not valid" and "Expression Expected"). I've included the code from one of these instances...
5
2501
by: Stephen | last post by:
Hi, Is there anyway I can make a column thats databound into a hyperlink to navigate to another page? Suppose I have 3 columns: SortOrder, Description, UserName for eg: <Columns> <asp:HyperLinkColumn Text="View" DataNavigateUrlField="UserId" DataNavigateUrlFormatString="ViewInfo.aspx?id={0}">
2
7991
by: markm75c | last post by:
Does anyone know of a way to sort a column which isnt databound or an actual field in the database, but is derived from a method? IE. I have a grid showing stats for softball, with a calculated field called AVG, I want to be able to sort based on AVG when they click on AVG. I can't seem to find a way to do this out there. Thanks!
1
2095
by: Carlos | last post by:
Hi all, I need a field that it is both databound, and hyperlink in a gridview. That is, the value is obtained from a query, and at the same time needs to point to a new page where will be used to make another query. How can this be possible in asp .net? Thanks in advance, Carlos.
3
3046
by: shapper | last post by:
Hello, In my GridView I have a HyperLink Field where I set the DataNavigateUrlFormaString MyHyperLinkField.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture=" & System.Threading.Thread.CurrentThread.CurrentCulture.ToString() I believe {0} retrieves the value of my datasource column with index 0.
3
11715
by: AG | last post by:
Below is code (slightly modified and converted to VB) that was provided to me in response to another post. I am using it to demonstrate another problem. In order for paging and other features to work properly in a gridview, viewstate must be enabled. So, in order to minimize the size of viewstate for a page, I will sometimes turn off viewstate for each control in template columns. That means that the gridview must be databound on each...
1
1337
by: Martin.Coetsee | last post by:
Fellow developers, I need to find out how to display one of the fields listed in my gridview as a hyperlink. The field displays the physical file path of for example a pdf file. I want my users to be able to click on the field(filepath) and the browser must open the file it points to. I am using VS2005, setup in web developer mode. The database behind it is MS-SQL 2005 thanks in advance! MartinCoetsee
3
2511
by: Uriah Piddle | last post by:
Hi Gang, in VS 2005, I have an Asp:Hyperlink in a GridView TemplateField. I am trying to figure out how to make the text of the hyperlink wrap to the next line if it is too long. Setting the Width prop of the hyperlink or the Wrap prop of either the GridView itself or the ItemTemplate does not work. Thanks for any ideas. Steve
1
6733
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid Programmatically. I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link My Question: 1) My EditITemTemplate column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that...
0
8444
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
8869
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
8781
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
8551
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
8639
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...
0
7386
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
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...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
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.