![]() |
Datagrid wire SelectedIndexChanged event from linkbutton
I have a datagrid with some dynamically generated columns containing
linkButtons. How can I wire these events to fire the datagrid_SelectedIndexChanged? When clicking a template column defined in the IDE it works fine, the event fires. However, anything that I add in code does not fire this event? Any idea? Thanks Alex |
RE: Datagrid wire SelectedIndexChanged event from linkbutton
I should note that generally speaking, adding controls to a datagrid like you
are doing is not a good idea. Your code is generally much cleaner if you use template columns. I have not checked this code, but this should work: lkButton.Click += new EventHandler(DataGrid1_SelectedIndexChanged); where lkButton is your Button and DataGrid1_SelectedIndexChanged is your datagrid selected index changed method. It is important to note that the sender object will be a LinkButton and not a DataGrid row or anything like that. Hope that helps! Jason Lind "Alex" wrote: > I have a datagrid with some dynamically generated columns containing > linkButtons. How can I wire these events to fire the > datagrid_SelectedIndexChanged? > > When clicking a template column defined in the IDE it works fine, the > event fires. However, anything that I add in code does not fire this > event? > > Any idea? > > Thanks > > Alex > > |
Re: Datagrid wire SelectedIndexChanged event from linkbutton
Jason,
Thanks for the reply. I am using a Template column in code to add the columns. How can I have the button inside my template column fire the datagrid SelectedIndexChanged? Thanks Alex |
| All times are GMT. The time now is 08:11 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.