G
guy
In my 1.1 project, I was creating dynamically a LinkButton, and stored
it into a Table.Row.Cell.Controls(). I was adding an MyOnClick handler
to the Click property. I was doing this during the Load phase. It
worked. Porting my code to 2.0, the Click event do not work anymore. It
is not generated in the intermediate c# files created by the
pre-compiling.
After some investiguation on the net, it appears that one must connect
a Click handler during the OnInit phase. But in that phase the
ViewState is empty, so I cannot re-create my controls. So this works
only if the control was on the postback page. Other posts seems to
indicate that one must now use the AddAttributes to generate an
"OnClick" attribute, calling a javascript, which will handle the detail
of the submit if I want a post back.
Is this the best way to generate a button click event handler, on a
dynamically created control ?
So many steps...
it into a Table.Row.Cell.Controls(). I was adding an MyOnClick handler
to the Click property. I was doing this during the Load phase. It
worked. Porting my code to 2.0, the Click event do not work anymore. It
is not generated in the intermediate c# files created by the
pre-compiling.
After some investiguation on the net, it appears that one must connect
a Click handler during the OnInit phase. But in that phase the
ViewState is empty, so I cannot re-create my controls. So this works
only if the control was on the postback page. Other posts seems to
indicate that one must now use the AddAttributes to generate an
"OnClick" attribute, calling a javascript, which will handle the detail
of the submit if I want a post back.
Is this the best way to generate a button click event handler, on a
dynamically created control ?
So many steps...