473,396 Members | 2,038 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,396 software developers and data experts.

Problem with Page_load and Button_Click event , wrong order

I have a problem, i have a form with some input boxes and a submit
button. In the Submit_Click event, the data from the input boxes is
stored in a database.

But, if you click the button, ASP.NET will first load the next
Page_Load and when that is done, it will do the Submit_Click event.
So on the page you don't see the data from the database, because it
is not there yet. When you refresh the page, the data is there, but
it has to be there without the refresh!

does anyone know how to fix this?

Greetz Vincent Scheel from the Netherlands

Nov 18 '05 #1
2 1483
Hi there,

Try to load you value in if(!ispostback) condition, then value will be
loaded only once.

Harshdeep Mehta
"Skating_vince" <Sk***********@hotmail-dot-com.no-spam.invalid> wrote in
message news:41**********@Usenet.com...
I have a problem, i have a form with some input boxes and a submit
button. In the Submit_Click event, the data from the input boxes is
stored in a database.

But, if you click the button, ASP.NET will first load the next
Page_Load and when that is done, it will do the Submit_Click event.
So on the page you don't see the data from the database, because it
is not there yet. When you refresh the page, the data is there, but
it has to be there without the refresh!

does anyone know how to fix this?

Greetz Vincent Scheel from the Netherlands

Nov 18 '05 #2
No, that's the problem, it has to be loaded, but only after the data
is changed in the database, but because of ASP.NET doing the
Button_Click event after the Page_Load, the data in the database
hasn't changed yet.

Nov 18 '05 #3

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

Similar topics

0
by: in | last post by:
I pass a variable from one aspx page to another using Context.Item.Add This works fine when the page first loads. I set the value of a static global var to the value of Context.Item in the...
7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
3
by: Michael Johnson Jr. | last post by:
The problem is the following pseudo code causes you need to click buttons twice to get event. This is notable via debugging and single stepping. I can't seem to quite figure out how to do...
2
by: Krista Lemieux | last post by:
Hello, In my form I have a button, and the button_Click function (which gets called when the button is clicked). However the functionality that I have in the button_Click function, needs to be...
2
by: Carlos | last post by:
Hi all, I just tried to use a static variable within the scope of the page_load event handler, but apparently it did not work all I wanted to do is to evaluate the postback condition and...
3
by: I am Sam | last post by:
Please help. I'm dying here and pulling out the last few remaining elements of my hair over this. I have built a form that will identify and authenticate users. I keep getting the following...
8
by: John Austin | last post by:
I need to understand why if I add a control and use AddHandler to connect its click event, it will work in Page_Load, but not in a Button_Click. The idea is that the user types some data, presses...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
1
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.