本文整理汇总了C#中System.Web.UI.Page.SetRenderMethodDelegate方法的典型用法代码示例。如果您正苦于以下问题:C# Page.SetRenderMethodDelegate方法的具体用法?C# Page.SetRenderMethodDelegate怎么用?C# Page.SetRenderMethodDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Page
的用法示例。
在下文中一共展示了Page.SetRenderMethodDelegate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleClientAPICallbackEvent
public static void HandleClientAPICallbackEvent(Page objPage, ClientAPICallBackResponse.CallBackTypeCode eType)
{
if (IsInCallback(objPage))
{
if (eType != ClientAPICallBackResponse.CallBackTypeCode.ProcessPage)
{
string[] arrIDs = objPage.Request[SCRIPT_CALLBACKID].Split(Convert.ToChar(" "));
string strControlID = arrIDs[0];
string strClientID = "";
if (arrIDs.Length > 1)
{
strClientID = arrIDs[1];
}
string strParam = objPage.Server.UrlDecode(objPage.Request[SCRIPT_CALLBACKPARAM]);
Control objControl = null;
IClientAPICallbackEventHandler objInterface = null;
ClientAPICallBackResponse objResponse = new ClientAPICallBackResponse(objPage, ClientAPICallBackResponse.CallBackTypeCode.Simple);
try
{
objPage.Response.Clear(); //clear response stream
if (strControlID == SCRIPT_CALLBACKPAGEID)
{
objControl = objPage;
}
else
{
objControl = Globals.FindControlRecursive(objPage, strControlID, strClientID);
}
if (objControl != null)
{
if ((objControl) is HtmlForm) //form doesn't implement interface, so use page instead
{
objInterface = (IClientAPICallbackEventHandler)objPage;
}
else
{
objInterface = (IClientAPICallbackEventHandler)objControl;
}
if (objInterface != null)
{
try
{
objResponse.Response = objInterface.RaiseClientAPICallbackEvent(strParam);
objResponse.StatusCode = ClientAPICallBackResponse.CallBackResponseStatusCode.OK;
}
catch (Exception ex)
{
objResponse.StatusCode = ClientAPICallBackResponse.CallBackResponseStatusCode.GenericFailure;
objResponse.StatusDesc = ex.Message;
}
}
else
{
objResponse.StatusCode = ClientAPICallBackResponse.CallBackResponseStatusCode.InterfaceNotSupported;
objResponse.StatusDesc = "Interface Not Supported";
}
}
else
{
objResponse.StatusCode = ClientAPICallBackResponse.CallBackResponseStatusCode.ControlNotFound;
objResponse.StatusDesc = "Control Not Found";
}
}
catch (Exception ex)
{
objResponse.StatusCode = ClientAPICallBackResponse.CallBackResponseStatusCode.GenericFailure;
objResponse.StatusDesc = ex.Message;
}
finally
{
objResponse.Write();
//objPage.Response.Flush()
objPage.Response.End();
}
}
else
{
objPage.SetRenderMethodDelegate(new RenderMethod(CallbackRenderMethod));
}
}
}