Dynamic Button OnClick not firing

Hi,

In the code behind of my ASP.net web page I have code written that is
dynamically creating a button. Here is a sample of how I define it.

//Define Variable
Button btnNext;

public void someMethod()
{
btnNext = new Button();
button += new EventHandler(this.btnNext_Click);
//then i add the control to the page, then call its click event
btnNext_Click();
}

When I clickthis button on the page, the page postsback and its onclick
event is never called (stepping through the code shows that it never gets
reached). If I click the button a second time, the method is called and it
works fine.

Im not sure if there is any more information I can give, and help would be
greatly appreciated

John Harte
JohnHarte [ Mo, 14 Januar 2008 15:40 ] [ ID #1907407 ]
Webserver » microsoft.public.inetserver.asp.general » Dynamic Button OnClick not firing

Vorheriges Thema: Suggestion Needed for Ticket / Inventory System...
Nächstes Thema: include and memory in apppool