How to get CommandText on ItemCommand event of the DataGrid?

G

Guest

Hi All,

I have the following scenario:
(1) I have one datagrid with 15 columns, out of which the Name column is
made the "Edit" button column.
(2) Names are loaded from Database through a Stored Procedure.
(3) Now when I click on any of the listed name the event is fired, but I
could not get the Name text, e.g. e.Item.Cells[1].Text returns blank as Name
is the 2nd column and it is Button Column whose DataTextField is bound to
value from database.

How can I get that name on this event? Please help.

Regards,
Shell
 
G

Guest

private void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{
Response.Write (((Button)e.CommandSource).Text);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top