Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Accessing the text in a cell of a gridview control

Thread Tools

Re: Accessing the text in a cell of a gridview control

Posts: n/a
On Wed, 17 Jan 2007 08:26:00 -0800, Randy
<(E-Mail Removed)> wrote:

>In the old datagrid control in VS2003 the text in a cell could be accessed
>by using the following sysntax:
>What is the Corresponding code to access the text in a cell of a new
>gridview control?
>Thanks for any help

You can access the items in the grid via the OnRowDataBound event


(for intance - for data in the first column)

You can iterate through the row with something like

if (e.Row.RowType == DataControlRowType.Header)
foreach (TableCell tc in e.Row.Cells)
tc.Text = tc.Text + ....

(for intance for the column headers)

If your GridView has DataKeyNames set equal the the key of the
DataView which populates the Grid then the record key on a particular
row (DataKey) will be:


(for instance for a GridView called gvManagers)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript to retrieve Gridview cell text Tony WONG ASP .Net 1 12-30-2009 06:26 AM
Retrieving GridView.Rows[x].Cells[y].text when cell ReadOnly isturned off S_K ASP .Net 1 06-05-2008 06:06 PM
How to get a text from a specified cell in the gridview? LamSoft ASP .Net 5 06-14-2007 08:25 AM
Re: Accessing the text in a cell of a gridview control James Irvine ASP .Net 0 01-17-2007 07:32 PM
How to set and highlight text in JTable cell on selection and/or invoke cell editor directly. Java 1 07-12-2004 10:22 PM