I am using grid view and a button column in it using <itemTemplate >
but I am not able to rerive cell value of a selected row from grid view.
I have tried the following to methods in Row_command event of gridview but it gives Null reference exception error while clicking the button in button column of grid view :
[code=cpp]
int index = gdvOdetails.Sel ectedIndex;
object oid = (object)gdvOdet ails.SelectedDa taKey.Values["o_id"];
txtMsg.Text = oid.ToString();
for (int i = 0; i < gdvOdetails .Rows .Count ; i++)
{
if (gdvOdetails.Se lectedIndex == i)
{
txtMsg .Text =gdvOdetails.Ro ws[i].Cells[1].Text;
}
}
[/code]
can any one help to retrieve cell value of grid in any variable using button column
but I am not able to rerive cell value of a selected row from grid view.
I have tried the following to methods in Row_command event of gridview but it gives Null reference exception error while clicking the button in button column of grid view :
[code=cpp]
int index = gdvOdetails.Sel ectedIndex;
object oid = (object)gdvOdet ails.SelectedDa taKey.Values["o_id"];
txtMsg.Text = oid.ToString();
for (int i = 0; i < gdvOdetails .Rows .Count ; i++)
{
if (gdvOdetails.Se lectedIndex == i)
{
txtMsg .Text =gdvOdetails.Ro ws[i].Cells[1].Text;
}
}
[/code]
can any one help to retrieve cell value of grid in any variable using button column
Comment