This is a migrated thread and some comments may be shown as answers.

Button in child table in grid

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 12 Jul 2011, 01:01 PM
I'm developing gridview parent and child hierarchy, here I have placed a button template column in child table and observed event is firing in Itemcommand but my question is how to get specific cell value in child table when I click on the button in the child window.

Suggest me how to overcome above one.

Advance Thanks,
Prasad.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jul 2011, 01:31 PM
Hello Prasad,

Try the following code snippet to access cell value in button click.

C#:
protected void btn_Click(object sender, EventArgs e)
{
        Button btn = sender as Button;
        GridDataItem item = (GridDataItem)btn.NamingContainer;
        string txt = item["ColumnUniqueName"].Text.ToString();
        
}

Thanks,
Princy.
Tags
Grid
Asked by
Prasad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or