Re: can I force Page.IsPostBack=false ?
- From: "Mark Fitzpatrick" <markfitz@xxxxxxxxxx>
- Date: Mon, 30 Oct 2006 17:40:12 -0600
You could put the code that is called in the Page_Load into a function so
you could code like so:
if(!Page.IsPostBack)
{
MyFunction();
}
Then in the button's click handler you can just call the function directly.
You don't have to bother with checking for a postback.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Guy Noir" <ahackney@xxxxxxxxx> wrote in message
news:1162250777.573372.223150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello again. I have a form that has 2 buttons. When button 1 is
pressed, I want the form to execute a few tasks and give the user
feedback. When button 2 is pressed, I want the form to reload as if it
is being called for the first time. That is, I want the code in
Page_Load if (!Page.IsPostBack) to execute as if we are calling the
page for the first time.
I guess I could do a server redirect or whatever, but is there a more
elegant solution?
TIA.
-Guy
.
- Follow-Ups:
- Re: can I force Page.IsPostBack=false ?
- From: Guy Noir
- Re: can I force Page.IsPostBack=false ?
- References:
- can I force Page.IsPostBack=false ?
- From: Guy Noir
- can I force Page.IsPostBack=false ?
- Prev by Date: Scope of Shared Properties
- Next by Date: Re: ASP 3.0 and ASP.NET 2.0 Side by Side
- Previous by thread: Re: can I force Page.IsPostBack=false ?
- Next by thread: Re: can I force Page.IsPostBack=false ?
- Index(es):