简体   繁体   中英

OnTextChanged not executed when !Page.IsPostBack

Page.IsPostBack命令执行时,是否可能未执行OnTextChanged =“”事件?

It is very unlikely that an OnTextChanged event will fire on a page's first load. It certainly can't happen as a result of user input but you certainly could manually fire it if you wanted to.

Something like this could trigger the event when not during a postback.

protected override void OnLoad(EventArgs e)
{
    tb.TextChanged += SomeHandler;

    if (!IsPostback)
    {
        tb.TextChanged(this, e);
    }
}

void SomeHandler(object sender, EventArgs e) { ... }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM