Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - IsPostBack
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

IsPostBack

 Post Reply Post Reply
Author
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Topic: IsPostBack
    Posted: 01 August 2006 at 12:57pm
Let me understand this, is it correct to say that, if I use this:
 

If Page.IsPostBack Then
  ... process form POST information ...
Else
  ... theres no form POST information, so run whatever's here ...
End If
 
POST info as in information submited from forms, and I'm assuming only forms submited with POST, not GET.
 
Is my logic correct?
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 01 August 2006 at 4:55pm
Well only HTML forms have Post and Get. In asp.net you don't really need that anymore.
In the page load you usually do something like

Private Sub Page_Load
If Not Page.IsPostback THEN
      BindData()
ELSE
      'Fires on Postback so we may not need to do anything
END IF
END SUB

Private Sub BindData
   'Do some SQL Binding or so
END Sub

Private Sub Button_Click()
'Insert a new Row or something
'This is where Post/Get Logic used to be and it actually fires AFTER the postback so if you don't have the postback in pageload, the data would be re-loaded EVERY time.
END Sub
Back to Top
scottage View Drop Down
Newbie
Newbie


Joined: 20 August 2004
Location: United Kingdom
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote scottage Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2007 at 9:26am
The purpose of testing for IsPostback is so that code that executes on the initial page load (i.e. pre-filling form fields from a database) doesn't happen when the user changes these values and submits the form so the event handler for the button click gets the users values not the database values as Page_Load will fire before the event handlers code
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.