Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Events not fired for Dynamically Created Controls in VS2005 ASP.NET 2.0

Reply
Thread Tools

Events not fired for Dynamically Created Controls in VS2005 ASP.NET 2.0

 
 
Richard Huang
Guest
Posts: n/a
 
      12-07-2005
Following code worked for VS.NET 2005 Beta 2, but not for the final
release. When clicking the button, it posted back, but the
"addQL_Click" method is not called. Any suggestion would be very much
appreciated.

public class MyEditor: EditorPart, INamingContainer
{
protected override void CreateChildControls()
{
Controls.Clear();
addButton("Add", "Add", new EventHandler(this.addQL_Click),
this.Controls);
ChildControlsCreated = true;
}
private void addButton(string buttonID, string buttonText,
EventHandler
myHandler, System.Web.UI.ControlCollection myControls)
{
Button _actionButton = new Button();
_actionButton.ID = buttonID;
_actionButton.Text = buttonText;
if (myHandler != null)
_actionButton.Click += myHandler;
myControls.Add(_actionButton);
}

private void addQL_Click(object sender, EventArgs e)
{
}
}

 
Reply With Quote
 
 
 
 
JJ
Guest
Posts: n/a
 
      01-09-2006
Hi Richard,

I got this problem too. Any solutions?

Thanks

"Richard Huang" wrote:

> Following code worked for VS.NET 2005 Beta 2, but not for the final
> release. When clicking the button, it posted back, but the
> "addQL_Click" method is not called. Any suggestion would be very much
> appreciated.
>
> public class MyEditor: EditorPart, INamingContainer
> {
> protected override void CreateChildControls()
> {
> Controls.Clear();
> addButton("Add", "Add", new EventHandler(this.addQL_Click),
> this.Controls);
> ChildControlsCreated = true;
> }
> private void addButton(string buttonID, string buttonText,
> EventHandler
> myHandler, System.Web.UI.ControlCollection myControls)
> {
> Button _actionButton = new Button();
> _actionButton.ID = buttonID;
> _actionButton.Text = buttonText;
> if (myHandler != null)
> _actionButton.Click += myHandler;
> myControls.Add(_actionButton);
> }
>
> private void addQL_Click(object sender, EventArgs e)
> {
> }
> }
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
Dynamically Created Gridview - Paging events are not fired ami ASP .Net 2 05-30-2007 08:22 AM
Events fired from dynamically created controls-VB.net ebown5@gmail.com ASP .Net Web Controls 5 08-02-2006 06:14 AM
VS2005 ASP.NET 2.0 does not fire event for dynamically created custom web controls Amelyan ASP .Net 2 11-05-2005 05:29 PM
Dynamically Created Controls in VS2005 ASP.NET 2.0 Amelyan ASP .Net Web Controls 1 11-04-2005 02:53 AM



Advertisments