Home All Groups Group Topic Archive Search About

dynamic control event not firing

Author
6 Apr 2005 12:22 PM
Ganesh Kumar via DotNetMonster.com
hai all!
In a web button click event iam creating a new web button and adding
handler to it. But that event is not firing when iam clicking a dynamic
button! plz reply...

--
Message posted via http://www.dotnetmonster.com

Author
6 Apr 2005 1:24 PM
Teemu Keiski
Hi,

dynamic controls need to be added at the Page_Load (at the latest) so that
they are able to raise postback events. So if you create and add add a
button in an click event handler, you need to recreate that dynamical button
on postback at the page_load (at the latest) so that it's able to raise its
Click event.

Reason for this is postback data loading happening twice, once before
Page_load and second time right after Page_load. After that second loading
phase, postback data is not loaded anymore and therefore controls added
aften this phase can't raise their events anymore. Postback events (like
Button's Click) are happening after this phase, so therefore you see uit in
your scenario.

--
Teemu Keiski
ASP.NET MVP, Finland


Show quoteHide quote
"Ganesh Kumar via DotNetMonster.com" <forum@nospam.DotNetMonster.com> wrote
in message news:6e94ed94374b4f2581d399c9e3139c06@DotNetMonster.com...
> hai all!
> In a web button click event iam creating a new web button and adding
> handler to it. But that event is not firing when iam clicking a dynamic
> button! plz reply...
>
> --
> Message posted via http://www.dotnetmonster.com
Author
7 Apr 2005 7:39 AM
Ganesh Kumar via DotNetMonster.com
Thanx TEEMU!
Actually wht iam doing is!Iam creating a report! When the user clicks
submit button,according to the selected date of the user i have to display
the data! Iam using webtable to display the data and iam adding a
htmlanchor to it.
when user click it server side click event should be raised and goto the
corresponding page!Any other way to do it!

--
Message posted via http://www.dotnetmonster.com