| ctually exists.
The end result of all of this is that it’s not exactly straight forward to deal with this mismatch and what needs to happen is that a wrapper object needs to be created that can decide which control to use. The wrapper needs to deal with deciding whether MS Ajax is available in the application and if it is, using Reflection to access the ScriptManager to write out any script code.
I can’t take credit for this though: Eilon Lipton posted about this issue a while back and his code really was what I needed to get this off the ground, I just wrapped the thing up into a ClientScriptProxy object that I used on a handful of controls. I basically added a handful of the ClientScript methods that I use in my applications. Here’s the class:
[*** code updated: 12/12/2006 from comments *** ]
/// <summary>
/// This is a proxy object for the Page.ClientScript and MS Ajax ScriptManager
/// object that can operate when MS Ajax is not present. Because MS Ajax
/// may not be available accessing the methods directly is not possible
/// and we are required to indirectly reference client script methods through
/// this class.
///
/// This class should be invoked at the Control's start up and be used
/// to replace all calls Page.ClientScript. Scriptmanager calls are made
/// through Reflection
/// </summary>
public class ClientScriptProxy
{
private static Type scriptManagerType = null;
// *** Register proxied methods of ScriptManager
pr 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |