当前位置: 首页>>代码示例>>C#>>正文


C# Page.SetRenderMethodDelegate方法代码示例

本文整理汇总了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));
                }
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:84,代码来源:ClientAPI.cs


注:本文中的System.Web.UI.Page.SetRenderMethodDelegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。