Changing .Text causes no Events

J

James Hancock

Hi, I've sort of asked this before, but I've refined my results a little:

if I do a loop like so:

foreach(System.Web.UI.Control ctl in Page.Controls) {
... if control is of type that has text property then...
ctl.text = Some Text from a database;
}

The post back events on the form don't fire.

However, if I change each by name like so:

lblExample.Text = "Hi there!";

Everything works fine.

Anyone have any ideas as to what may be causing this?

There's no errors being thrown in the first example, so I'm at a loss...

Any help would be greatly appreciated.

James Hancock
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top