Changing .Text causes no Events

Discussion in 'ASP .Net' started by James Hancock, Apr 6, 2004.

  1. 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
    James Hancock, Apr 6, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.