Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How to avoid execution of page_load event before click event of a (http://www.velocityreviews.com/forums/t122964-how-to-avoid-execution-of-page_load-event-before-click-event-of-a.html)

=?Utf-8?B?Sm9zZVZhbGVuY2lh?= 04-03-2006 04:28 PM

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

sirfunusa 04-03-2006 04:37 PM

Re: How to avoid execution of page_load event before click event of a
 
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.


sirfunusa 04-03-2006 04:53 PM

Re: How to avoid execution of page_load event before click event of a
 
Oh, perhaps you mean the "server" page load happens first, which is
true. Then use

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

End if


rachana 04-03-2006 04:58 PM

Re: How to avoid execution of page_load event before click event of a
 
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.


=?Utf-8?B?Sm9zZVZhbGVuY2lh?= 04-04-2006 11:00 AM

Re: How to avoid execution of page_load event before click event o
 
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
>
>


=?Utf-8?B?Sm9zZVZhbGVuY2lh?= 04-04-2006 11:00 AM

Re: How to avoid execution of page_load event before click event o
 
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.
>
>



All times are GMT. The time now is 09:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.