mercredi 16 décembre 2009 2.0: ListControl Vs WebControl when (Page.IsCallback == True)

In 2.0 :

- you can catch asynch Event on implementing ICallBackEvent Handler.
- the Event LoadViewState is raised after a POSTPACK

So if you create 2 Custom web controls ( "WC1" and "WC2"):

-WC1: inherits from "WebControl" and implements " ICallBackEvent Handler"

-WC2: inherits from "ListControl" and implements " ICallBackEvent Handler"

-override the LoadViewstate in the 2 controls and put a breakpoints.

On the click event of WC1, you call a Javascript Method that send a Callback to the Server

Normally When you click on WC1, the LoadViewState event will be not raised because is not a POSTBACK event, BUT strangelly in the WC2 the LoadViewState method is raised!

So the conclusion is, All controls that inherits from "ListControl" raise the LoadViewState method evenif there is no postback!


Rechercher dans ce blog