Tassisto
Tassisto

Reputation: 10365

How to get Text value of Label-controls in cells of GridView?

In my GridView there is a column containing Label-controls as value. I need to know how to access each Label-control to get its Text value. Any help is appreciated.

Upvotes: 0

Views: 913

Answers (2)

user554180
user554180

Reputation:

handle selectedIndexChanged event and in it do

string text = ((Label)grid.SelectedRow.Cells[cellIndex]).Text;

string text = grid.SelectedRow.Cells[0].Text; // this should do the trick

Upvotes: 1

Fraz Sundal
Fraz Sundal

Reputation: 10448

You can store its value in a hidden field and place it in any other column. Then when you retrieve that row value you can access that hiddenfield value

Upvotes: 2

Related Questions