473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page_Load problem

Hi

In Page_Load event I retrieve data from db and put them
into text controls. When I change some data and then
press the Send button, first the Page_Load is called, and
then method for Send button, in which I put data into db.
I cant change anything because every time I press Send,
first Page_Load is called and its discards every changes I made.
How to get around this?
Thanks in advance for any advice.

Lu
Nov 18 '05 #1
3 1417
Get the Data only when the Page Loads for the first time, this can be done by checking for Page.IsPostBac

if(! Page.IsPostBack

// Write code here to get data from DB
I hope this solves your problem

Thanx

Nimish
Nov 18 '05 #2
Hi,

PageLoad fires each time in ASP.Net to get ride of that u can use
Page.IsPostBack property.

If the Page.IsPostBack property is false, the page is loaded for the first
time, if it is true, the page is posted back to the server .

Regds.
Sanjai

"DirkDiggler" <jo*****@op.pl> wrote in message
news:cE*******************@news.chello.at...
Hi

In Page_Load event I retrieve data from db and put them
into text controls. When I change some data and then
press the Send button, first the Page_Load is called, and
then method for Send button, in which I put data into db.
I cant change anything because every time I press Send,
first Page_Load is called and its discards every changes I made.
How to get around this?
Thanks in advance for any advice.

Lu

Nov 18 '05 #3
Thanks

Few minutes after sending that post i made it up by myself.
Before, I tried to use Request.IsPostBack but it wasnt
it. Page.IsPostBack solved the problem.

Thanks
Lu
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jibey | last post by:
Hello: I'm facing a very strange problem. When I run my Web application in Visual Studio.NET the Page_Load event is not executing. Other events like a Button_Click are executing. It doesn't...
0
by: Itai | last post by:
Background: I have four Web Form pages with respective C# code behind files, all in the same project: localhost/vpath1 Page1.aspx Page2.aspx
2
by: Mark Rae | last post by:
I've inherited an ASP.NET app and have been asked to fix the following problem with a page which is used to display and/or delete records from a database. When the page loads, it displays a list of...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
3
by: doobdave | last post by:
Hi all, I'm experiencing a rather strange problem: I am coding a web application using VB.net ASP.net and Visual Studio 2003. It's quite a large application, but the problem only occurs on...
4
by: tshad | last post by:
Is there a way to do put Page_loads on a page? I am trying to setup a Page_Load that just puts a persons name that is logged on at the top of a page the first time a page is loaded. In my...
0
by: jonelling | last post by:
I am having a problem where the page load event is not being fired for certain user controls that I load dynamically in placeholders. Here is what I'm doing in brief, with full test code supplied...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
1
by: choukrou | last post by:
Hello everybody! Got a nice problem on 1 of my aspx (and only one): It was working "perfectly" for 1year and a half. Last week I had to fix a lil bug. I do that and test my app. And on the fixed...
11
by: fiefie.niles | last post by:
I am using ASP.NET 2005 and I have a simple form. Page_Load calls a sub mySub that does not do anything (for testing purposes). But, Page_Load gets called twice. On every single ASPX page in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.