473,467 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to avoid execution of page_load event before click event of a

I have a page where I initialize a textbox.text value in the page_load event
.. I have also a button where I want to do something with the value of the
textbox.text . The user can change manually the value of the textbox. I have
noticed that the textbox.Text property has always the initial value inside
the the click event of the buttom because the page_load event is executed
always before the click event. Any way to avoid this?

Thanks
Apr 3 '06 #1
5 1591
That is incorrect. The click event (on the server) happens first,
before the page is rendered back to the client. Post the minimum code
necessary here to demonstrate your problem.

Apr 3 '06 #2
Oh, perhaps you mean the "server" page load happens first, which is
true. Then use

If Not Page.IsPostBack...
.....

End if

Apr 3 '06 #3
use IsPostback.

if(!IsPostBack)
{
// code to initialize textbox
}

Now when the button is clicked, page is reloaded but as it is being
posted back the code in if block won't execute, so textbox.text won't
be reinitialized.

Apr 3 '06 #4
Thank you, that's what I need

"sirfunusa" wrote:
Oh, perhaps you mean the "server" page load happens first, which is
true. Then use

If Not Page.IsPostBack...
.....

End if

Apr 4 '06 #5
Thank you, that's what I need

"rachana" wrote:
use IsPostback.

if(!IsPostBack)
{
// code to initialize textbox
}

Now when the button is clicked, page is reloaded but as it is being
posted back the code in if block won't execute, so textbox.text won't
be reinitialized.

Apr 4 '06 #6

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

Similar topics

13
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the...
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
11
by: Homam | last post by:
The ASP.NET model is touted as a clean OO approach to developing web pages, yet sometimes the page lifecycle poses silly obstacles that forces you revert to the Olde ASP 3.0 Ways. Here's a rough...
6
by: Moses | last post by:
Hi All, How to avoid the execution of a function at the time of defining. Here i am giving the details. I am creating the following div container through DOM.
4
by: DC | last post by:
Hi, the subject says it all. Since visible=false controls will still run though Page_Load, I was hoping that the MultiView would somehow manage to avoid a Page_Load of controls in its inactive...
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...
1
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.