AJAX UpdatePanel - IsInAsyncPostBack and IsPostBack returning false

P

PSY

I am having an issue with the AJAX Update Panel and PostBack.

My issue is such. I have a series of checkbox'es with events tied to
them and autopostback="true". For the most part, things are running
great. However, in my Page_Init and Page_Load sections, there is code
that should only be accessed when not a post-back. My issue is that
if I quickly click through the events (toggle the checkboxes with the
bound events), both IsInAsyncPostBack and IsPostBack will become false
(Typically they will be true.). Any Ideas what is causing this
behavior or a workaround I could use?
 
P

PSY

I'm going to rephrase this question a bit. Perhaps I was unclear in
the above.

I have an asp.net webpage.

On that page, there is an update panel with several check boxes in
it. Each of those check boxes has an autopostback="true" attribute
set and a method attached to it that performs some logic on the page.
When one of these events is fired, a partial postback is performed and
the code for that event and the page life cycle events fire
(Page_Init, Page_Load, etc,,,) In my Page_Init and Page_Load blocks,
there is code that should only be executed when the page is first
loaded. Hence, I performed a check for Page.IsPostBack andalso
ScriptManager.GetCurrent(Page).IsInAsyncPostBack during these phases.
Typically, if you click one of these checkboxes, the event fires and
both the IsPostBack and IsInAsyncPostBack values are true, so this
code doesn't execute (Exactly what is desired). However, if you
quickly click on a number of the checkboxes one after another,
eventually you will have your IsPostBack and IsInAsyncPostBack values
become false. I know this, because I have set breakpoints inside of
this section and have examined the values of those statements.

Does anyone have any ideas why I am having this issue?

For now, I would take a workaround if anyone has any. Basically what
I need is a bit flag that lets me know if this is my first access to
the page. I cannot use a viewstate boolean flag because I need it in
the Page_Init and we don't want to use the QueryString, because we
like to keep a clean URL here. Any Ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top