Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Event from Control embedded in another control not firing on web form.

Reply
Thread Tools

Event from Control embedded in another control not firing on web form.

 
 
scotprince@gmail.com
Guest
Posts: n/a
 
      03-10-2006
Hi,

I am hoping someone here can help. I have one custom control called
"MyButton". On another custom control (CC2) I dynamically create a
table and add the "MyButton" control to a cell or cells depending on
what happens on the web form. Then I embed CC2 onto a web form and
everything compiles and runs. I get the custom button(s) generated.
The problem is that the button click event is not firing on the web
form. Below is the code on how I am creating the buttons in "MyButton"
control.

protected override void CreateChildControls()
{
radbtn = new CallbackButton();
radbtn.Text = "Click Me";
radbtn.Click += new EventHandler(btn_Click);
Controls.Add(radbtn);
base.CreateChildControls ();
}


protected override void Render(HtmlTextWriter output)
{
base.Render(output);
}


private void btn_Click(object sender, EventArgs e)
{
radbtn.Text = "I was clicked!";

}

}

Now if I embed "MyControl" straight onto a webform I can get the click
events. It is when "MyControl" is embedded in another control is when
I cannot get the event.
Do I have to have CC2 subscribe to MyButtons click event then send that
onto the web form?
Any ideas? Thanks!

sp

 
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
TkInter bind() event is not firing event trigger Anthony Papillion Python 3 06-23-2010 12:55 AM
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
User Control Button Click event not firing when placed in a Web form ~~~ .NET Ed ~~~ ASP .Net 3 09-08-2008 05:36 AM
another sleepless night- cust control event not firing xamman ASP .Net 0 01-05-2007 10:40 PM
DataGrid embedded in a control: no DeleteCommand event firing COUTIER Eric ASP .Net Building Controls 0 12-14-2003 09:33 PM



Advertisments