What does IsPostBack actually mean?

后端 未结 5 661
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 09:37

I am interested to know what specifically Page.IsPostBack means. I am fully aware of it\'s day to day use in a standard ASP.NET page, that it indicates that the user is sub

5条回答
  •  孤城傲影
    2021-01-05 10:09

    One way to do this is to extend the ASP.NET Page class, "override" the IsPostBack property and let all your pages derive from the extended page.

    public class MyPage : Page
    {
        public new bool IsPostBack
        {
            get 
            { 
              return 
                Request.Form.Keys.Count > 0 &&
                Request.RequestType.Equals("POST", StringComparison.OrdinalIgnoreCase); 
             }
        }
    }
    

提交回复
热议问题