Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Checking the postback in C#


Message #1 by "Oliver, Wells" <WOliver@l...> on Mon, 14 Oct 2002 14:07:46 -0700
I have this code:
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Page load event
			if (!this.IsPostBack)
				this.GetData();
		}

However, it seems to run GetData() every time. Am I not checking the
postback correctly? I also tried this.Page.IsPostBack to no avail.

Any clues?

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com

Message #2 by =?iso-8859-1?Q?Lars_Gyldenk=E6rne?= <lgy@n...> on Tue, 15 Oct 2002 09:36:02 +0200
Hi,

You just have to write : if (!IsPostBack)

This works fom me.

Lars Gyldenk=E6rne




-----Original Message-----
From: Oliver, Wells [mailto:WOliver@l...]
Sent: 14. oktober 2002 23:08
To: ASP+
Subject: [aspx] Checking the postback in C#


I have this code:
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Page load event
			if (!this.IsPostBack)
				this.GetData();
		}

However, it seems to run GetData() every time. Am I not checking the
postback correctly? I also tried this.Page.IsPostBack to no avail.

Any clues?

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com


---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450

These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples. 

---

  Return to Index