Page.isPostBack ????

G

Guest

Dear all,

Is there any particular rules on the type of code we usually place inside
the Page load event and checking the IsPostback status ?

As a beginner I could imagine to put quite many things inside this Postback
condition but I doubt it is the tight way to do

regards
serge
 
S

S. Justin Gengo

Serge,

I use the following template inside the page load event and then put my code
in the necessary spots:

Try

'---Every page load

If Not IsPostBack Then

'---First page load only

Else

'---Post back only

End If

'---Every page load

Catch ex As Exception

'---Process Exception

End Try


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
K

Karl Seguin

The main use for IsPostBack is that you initially set control values when
IsPostBack is false (the page is first loaded) but don't want to do so when
it's true, because the control values will be repopulate from viewstate.

Karl
 
M

Mark Rae

The main use for IsPostBack is that you initially set control values when
IsPostBack is false (the page is first loaded) but don't want to do so
when it's true, because the control values will be repopulate from
viewstate.

Added to this, if you have any databound controls e.g. DropDownList controls
etc, populate them in the Page_Init event, not the Page_Load event...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top