By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,558 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,558 IT Pros & Developers. It's quick & easy.

referring to a datagrid button from Page_Load

P: n/a
How can I refer to a linkbutton that's a part of my datagrid from
Page_Load? myButton.property doesn't work.
myDataGrid.Findcontrol("myButton") doesn't work. I'd like to set some
onClick attributes for it.

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You'll need to use find control on a DataGridItem (a row) instead of on the
DataGrid since there could be multiple row and therefore multiple button.

See: http://odetocode.com/Articles/116.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/
How can I refer to a linkbutton that's a part of my datagrid from
Page_Load? myButton.property doesn't work.
myDataGrid.Findcontrol("myButton") doesn't work. I'd like to set some
onClick attributes for it.

Nov 19 '05 #2

P: n/a
Thanks for the great article! My control was in the header, too, so I
ended up using :

btnDelete =
dgParent.Controls(0).Controls(1).FindControl("btnD elete")
Not pretty, but effective.

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.