views:

144

answers:

3

I created a marker interface:

public interface ISupportAJAXPostsBacks{}

I added it to my Page..

public partial class MyWebForm : PageBase, ISupportAJAXPostsBacks

I have this check in my PageBase class...

if(this is ISupportAJAXPostsBacks)
{
   ... do some stuff ...
}

If I step through via the debugger, "this is ISupportAJAXPostsBacks" evaluates to true for the initial page load, but evaluates to false when an UpdatePanel posts back on that same page. (scratches head)

What is happening under the covers to cause this and what can I do about it?

A: 

I could not replicate your situation, but some ideas for things to check...

-the if statement should be in an override of OnLoad in your PageBase

-the if statement should be before the base.OnLoad(e) call in that override method

-check settings on your ScriptManager control... in particular the EnablePartialRendering and EnablePageMethods

I think the last item would only be an issue if you were actually using those methods, but if you do have them enabled I would try disabling them. Hope that helps.

Marty
A: 

This may help:

Are you making these 3 common ASP.NET AJAX mistakes?

rick schott
+1  A: 

When your page first loads, "this" is the entire page, but when you partial postback, "this" becomes only the part which posted back, which is not the same as the full page, and so it does not implement your interface.

SLC