开发者

OnTextChanged not executed when !Page.IsPostBack

is it possibl开发者_Python百科e that OnTextChanged="" event is not executed when!Page.IsPostBack command is executed?


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) { ... }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜