| Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development | Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
| Author | Forum: PowerWEB LiveControls for ASP.NET Topic: Detect live callback in the PageLoad() method |
| yburtin From: Paris, France Posts: 3 Member Since: 10/18/05 |
posted February 22, 2006 11:57 AM Hi, I have live and non live controls on a page. I want to know, inside the PageLoad() method, if I am here because of a live callback (several live controls on the page) or because some other action. I don't want to use the [MyLiveControl].IsCallback attribute because in that case, I have to specify the name of the live control. I want to have a generic method I can use in several pages just to know if it's a live callback or not. Is there a simple way of doing that? |
John Talarico![]() From: Rome, NY USA Posts: 630 Member Since: 06/01/05 |
posted February 22, 2006 1:28 PM There is no global or page-level way to check if a page is loading because of a callback. If you want something generic, you would have to recursively iterate through the control hierarchy on the page. If the control implements the ILiveControl interface, you can test the IsCallback property. Frankly, this is a bit of overkill and will add unnecessary processing. The simplest method is to put a LivePlaceholder on your page that will remain empty and unused but will be able to report the IsCallback property. |
| RyanH From: Ottawa, ON Canada Posts: 29 Member Since: 06/27/06 |
posted July 25, 2006 11:32 AM I am iterating through all the controls on my page and want to detect which are Live controls. Then I will add extra attributes to them. I know about typeof to test for a particular control such as LiveButton or LiveText, but how can I test to see if a control implements the ILiveControl interface? Thanks! |
Jeff Cranford![]() From: Rome, NY USA Posts: 586 Member Since: 05/30/01 |
posted July 25, 2006 2:37 PM You could use the following function to test. internal static bool IsLiveControl(Control c) { Type[] interfaces = c.GetType().GetInterfaces(); foreach(Type i in interfaces) { if(i.FullName.IndexOf("Dart.PowerWEB") > -1 && i.FullName.IndexOf("ILiveControl") > -1) return true; } return false; } |
| Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|