473,406 Members | 2,439 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,406 software developers and data experts.

add a hyperlink in each data field

The following prints a table of datagrid:

Dim dt As DataTable = ds.Tables(0)
dgEmployeeInfo.DataSource = dt
dgEmployeeInfo.DataBind()

I want to add a hyperlink in each ID field, so that the user can click it
and see the detailed information of each employee.

I have no idea how to print it row by row in a data grid, please help!!


Nov 18 '05 #1
1 1755
SSW
Hi!

Trap ItemDataBound Event for datagrid and Set e.Item.Cells[0].Text value as
hyperlink. U code will look like as below

private void dg_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
int i = 0;// Column Number where u want to have hyper link
DataRow dr = ((System.Data.DataRowView)e.Item.DataItem).Row;// this is a
current data Row
if (e.Item.ItemType.ToString() !="Header")
if(e.Item.DataItem !=null)
{
e.Item.Cells[i].Text = @"<a
href=\"EmplyeeChickPage.aspx\">Emplyee ID</a>";
// U can add hyperlink control dynamically to cell over here
e.Item.Cells[i]
//
}
}

Hope this helps.

Thanks,

sswalia
MCAD, MCSD, OCA

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
The following prints a table of datagrid:

Dim dt As DataTable = ds.Tables(0)
dgEmployeeInfo.DataSource = dt
dgEmployeeInfo.DataBind()

I want to add a hyperlink in each ID field, so that the user can click it
and see the detailed information of each employee.

I have no idea how to print it row by row in a data grid, please help!!

Nov 18 '05 #2

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

Similar topics

3
by: Phil | last post by:
I am looking to set up a hyperlink control on a form to retrieve letters that correspond to a record on a form. That is, there may be 100 form records, and I would like each of those form records...
3
by: Ray | last post by:
I recently upgraded from Access 97 to Access 2003 and just enter some new data into table via an input form. The form has one hyperlink field to contain a file path. In Access 2003, it appears...
4
by: Andreas Meffert | last post by:
Hello, How can I change the Type of a field in a table from Memo to hyperlink? I import a table from Oracle to Access 2003. After that, the field type of some hyperlink-fields is "Memo". How...
9
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 =...
2
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...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
13
ADezii
by: ADezii | last post by:
Recently, there have been several questions and much confusion concerning the Topic of Hyperlinks. Specifically, Users wanted to know how to retrieve a File Name from a FileDialog Box, copy the Name...
1
by: rishiv | last post by:
Hi, I'm using MS Access 2002 SP3 & Visual Basic 6.3 on WinXP Home SP2. I have a table of condition data (5990 records) that relates to information stored in a proprietary application. The...
5
LAD
by: LAD | last post by:
Using Access 2003 on Windows 2000. My Skill Level: Med Low (Some VBA, okay with Access) Form: Single View - based on Query of single Table to sort by field. Application: Dealers email 'contract...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
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,...

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.