Re: Dynamic WebControl events...
Stacey Levine <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <A48E95FB3D4D02449554AE952F3B3E4702FC424E@vmcexchng.www.musicforasong.net> |
Set the autopostback of the checkbox to true Thanks. Stacey -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Mike Andrews Sent: Wednesday, February 14, 2007 10:51 AM To: [email protected] Subject: [DOTNET-WEB] Dynamic WebControl events... Guys, I'm having problems getting an aspx page to process an event for a control, namely a checkbox, that was dynamically created and added to the form. Any suggestions? Thanks, Mike Here's a sample of the code: protected void Page_Load(object sender, EventArgs e) { CheckBox cb = new CheckBox(); cb.ID = "test"; cb.Text = "Click Here!"; cb.CheckedChanged += new EventHandler(cb_CheckedChanged); this.Form.Controls.Add(cb); } void cb_CheckedChanged(object sender, EventArgs e) { //Do something here } =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com