Re: can I force Page.IsPostBack=false ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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



.



Relevant Pages

  • RE: Calling sp_getapplock
    ... All I needed to do was to execute a "select 1" prior to calling sp_getapplockthe first time through using a select mode for "cursor" and setAutoCommitfalse. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: CICS and COBOL reentrancy was Re: Further discussion on "Something has to be maintained" and lac
    ... branched, based on the progress indicator, which was set immediately ... different in that the next code to execute could be enqueued against the ... EIBCALEN indicates whether this is the first time in, ... at which point the next one comes in with IT's terminal-dependent ...
    (comp.lang.cobol)
  • Re: Thought Youd Like to Know
    ... calling your action a Crusade. ... and not the first time that you are out to start ... your reaction to the word "Crusade" was excessive. ... I have heard and seen numerous Jews use that word and nobody objected ...
    (soc.culture.jewish.moderated)
  • Re: CoInitializeEx and DirectShow?
    ... > calling a method that exists on a COM object created in a different thread? ... > The method would, of course, execute in the calling thread, not the creating ... other than to avoid calls to PeekMessage and SendMessage during ... calls to other objects in the same apartment/thread. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: AllegroCL and compute-discriminating-function
    ... (values nil nil)) ... (funcall default-discriminating-function a))))) ... Calling #'test the first time works. ...
    (comp.lang.lisp)