471,627 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

ButtonColumn

On a web form I have a grid, grid1, with a ButtonColumn bound to a field in a
table. When the button is clicked I want do do something with the data view
in the row clicked. How do I retrieve the data in the clicked ButtonColumn?
When I use

GridViewRow selectedRow = GridView1.Rows[index];
TableCell installationName = selectedRow.Cells[1] ;
TextBox1.Text = installationName.Text;

It returns blank text.

How do I get the value in the clicked ButtonColumn?
Dec 8 '05 #1
1 1808
Dave:

I believe in this case the data is bound to a button control rather than the
table cell. You can access the controls of a table cell by using the
Controls collection of the TableCell class, or alternatively by using the
FindControl method of the TableCell class. You code might looking something
like the following:

GridViewRow selectedRow = GridView1.Rows[index];
TableCell installationName = selectedRow.Cells[1] ;
Button myButton =
(Button)installationName.FindControl("MyButtonName ");
TextBox1.Text = myButton.Text;

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Dave" <Da**@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
On a web form I have a grid, grid1, with a ButtonColumn bound to a field in
a
table. When the button is clicked I want do do something with the data view
in the row clicked. How do I retrieve the data in the clicked ButtonColumn?
When I use

GridViewRow selectedRow = GridView1.Rows[index];
TableCell installationName = selectedRow.Cells[1] ;
TextBox1.Text = installationName.Text;

It returns blank text.

How do I get the value in the clicked ButtonColumn?
Dec 8 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jonathan | last post: by
4 posts views Thread by CGuy | last post: by
3 posts views Thread by John | last post: by
3 posts views Thread by ruca | last post: by
1 post views Thread by Lenin Sakthees via .NET 247 | last post: by
1 post views Thread by Sathyaish | last post: by
1 post views Thread by nipe | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.