UserControl has IsPostBack, but Control does not

后端 未结 1 583
渐次进展
渐次进展 2020-12-12 04:50

i\'m trying to solve a bug in Visual Studio, the suggestion is to stop using UserControls and use Control instead..

So i\'m converting all my UserControl

相关标签:
1条回答
  • 2020-12-12 05:34

    Control has a Page property, which has an IsPostback property. This should give you the value you need.

    public class MyControl : Control{
        protected override void OnInit( EventArgs e ){
            if( this.Page.IsPostBack ){
                // do something
            }
        }
    }
    

    MSDN Reference

    0 讨论(0)
提交回复
热议问题