Postback question

Larry Brister
Larry Brister used Ask the Experts™
on
I know that there is a databinding difference on whether or not to use If Not Page.IsPostBack and If Page.IsPostBack = False.

However...
Is there a difference between
        If Not IsPostBack Then

        End If

and this
        If Not Page.IsPostBack Then

        End If
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
No. For Page.IsPostBack, Page is almost like a this pointer. For IsPostBack, since you are working inside of the class that defines the member IsPostBack, there is basically an implicit this (i.e. this.IsPostBack). The two are interchangeable.

As for UserControls, there is a slight difference because when you say Page.IsPostBack you are referring to the IsPostBack member of the Page that houses the UserControlp. When you say simply IsPostBack within a UserControl, then you are referring to the UserControl's IsPostBack member itself, not the one on the Page.
Larry Bristersr. Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial