473,395 Members | 1,464 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,395 software developers and data experts.

Creating a links column in an asp datagrid

I have a datatable that contains a number of web addresses as type nvarchar
(eg 'www.msdn.com').
I want to use these as hyperlinks in a datagrid column.

Whats the best way to do this? How can I set the NavigateURL property for
each row of a HyperLinkField column dynamically? Is this even the best way to
do it?

Thanks
Mar 2 '07 #1
2 1265
Howdy,

<asp:DataGrid runat="server" ID="klapa">
<Columns>
<asp:HyperLinkColumn
DataNavigateUrlField="ColumnContainingLinks"
DataNavigateUrlFormatString="http://{0}"
DataTextField="ColumnContainingLinks"
DataTextFormatString="{0}"/>
</Columns>
</asp:DataGrid>

Hope this helps
--
Milosz
"Esemi" wrote:
I have a datatable that contains a number of web addresses as type nvarchar
(eg 'www.msdn.com').
I want to use these as hyperlinks in a datagrid column.

Whats the best way to do this? How can I set the NavigateURL property for
each row of a HyperLinkField column dynamically? Is this even the best way to
do it?

Thanks
Mar 2 '07 #2
Thanks mate, your a star. It worked fine.

"Milosz Skalecki [MCAD]" wrote:
Howdy,

<asp:DataGrid runat="server" ID="klapa">
<Columns>
<asp:HyperLinkColumn
DataNavigateUrlField="ColumnContainingLinks"
DataNavigateUrlFormatString="http://{0}"
DataTextField="ColumnContainingLinks"
DataTextFormatString="{0}"/>
</Columns>
</asp:DataGrid>

Hope this helps
--
Milosz
"Esemi" wrote:
I have a datatable that contains a number of web addresses as type nvarchar
(eg 'www.msdn.com').
I want to use these as hyperlinks in a datagrid column.

Whats the best way to do this? How can I set the NavigateURL property for
each row of a HyperLinkField column dynamically? Is this even the best way to
do it?

Thanks
Mar 2 '07 #3

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

Similar topics

1
by: VM | last post by:
Is it possible for the bound data in a web datagrid to be displayed in links? The grid will show the client's first name and last name and, when the user clicks on the first or last name, I want...
0
by: Lenny | last post by:
Hello, I have an html table template which I want to turn into ASP.NET custom control. I want to utilize the best features of OOP. I want to be able to create columns headings dynamically, add...
3
by: Jim Corey | last post by:
I have a datagrid displaying a report, which includes link buttons that I use to drill down. A. When I return to the datagrid the links display as visited. B. If I run my report again and...
1
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has...
1
by: David C | last post by:
I am trying to dynamically create a datagrid with code that looks exactly like what the asp tags show below. It has only one column and that column is a template column with a link button control....
3
by: Terry Olsen | last post by:
I have a datagrid filled with shipping records. I would like to make the field that contains the tracking numbers to be links where the user can click and automatically track that particular...
4
by: Jeff | last post by:
I am stuck on trying to generate two columns headers for a datagrid on form load. I can use a datatable as the datasource and get the results I want, but I want to set different column widths and...
0
by: slemen | last post by:
Hi, The DataGrid aps:EditCommandColumn when used with column templates created programmatically does not trigger the _Edit subroutine in code. The ASP:Datagrid definition is below (1), the...
5
by: tshad | last post by:
I found I can create Template columns dynamically - as long as I don't use objects that need onclick events, such as a LinkButton. Textboxes and Labels work fine. I create the Template columns...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
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
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
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.