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