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) { ... }
精彩评论