Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting BoundField Value in gridview row_command

I need to get the bound field value of the selected column in gridview_rowcommand.

Any ideas?

like image 867
pinki Avatar asked Dec 22 '22 15:12

pinki


2 Answers

it will be like...

GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
row.Cells[0].Text
like image 181
Muhammad Akhtar Avatar answered Dec 24 '22 05:12

Muhammad Akhtar


It should be something like this.

if (e.CommandName=="CommandName")
    {
        int index = Convert.ToInt32(e.CommandArgument);
        GridViewRow row = GridView1.Rows[index];
        string boundFieldText= row.Cells[0].Text;
    }
like image 32
Özgür Kaplan Avatar answered Dec 24 '22 03:12

Özgür Kaplan