473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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:TemplateField>
<ItemTemplate>

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

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

</ItemTemplate>
</asp:TemplateField>

--FileLink is the datafield name which provides the link
--
Thanks & Regards
Valli
Sep 27 '07 #1
1 7124
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<Links>
<Link FileLink="http://www.microsoft.com"/>
<Link FileLink="http://msdn.microsoft.com"/>
<Link FileLink="http://technet.microsoft.com"/>
</Links>
</Data>
</asp:XmlDataSource>

is the source for

<asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1">
<Columns>
<asp:HyperLinkField
DataNavigateUrlFields="FileLink"
DataTextField="FileLink"/>
</Columns>
</asp:GridView>

and

<asp:GridView ID="GridView2" runat="server" DataSourceID="XmlDataSource1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
Text='<%# Eval("FileLink") %>'
NavigateUrl='<%# Eval("FileLink") %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</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
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...
5
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>...
2
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...
1
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...
3
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=" &...
3
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...
1
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...
3
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
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...
0
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...

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.