dnn一些公用方法分析 dodo

 1.' returns a boolean value whether the control is an admin control
        Public Function IsAdminControl() As Boolean

            ' This is needed to avoid an exception if there is no Context.  This will occur if code is called from the Scheduler
            If HttpContext.Current Is Nothing Then
                Return False
            End If
            Return (IsNothing(HttpContext.Current.Request.QueryString("mid")) = False) Or _
             (IsNothing(HttpContext.Current.Request.QueryString("ctl")) = False)

        End Function
分析:
IsAdminControl() =true ( 本质就在于ctl=null 或者 ModuleId =null)
就加载module主页面。主页面和其他页面的区别就在与controlkey=null。
2.dnn客户端API函数

RegisterClientScriptBlock: [void RegisterClientScriptBlock (string key,string script)]使用该方法,可以在页面的顶端发布指定的脚本块.每个脚本块与一个键相关连,页面中控件的实例也应该使用该键访问相应的脚本块.该脚本必须在控件之前给出.该脚本块可以包含嵌入式代码与外部脚本程序.

IsClientScriptBlockRegister: [bool IsClientScriptBlockRegister(string key)]检查指定的脚本块是否注册.

RegisterStartupScript: [void RegisterStartupScript(string key,string script)]与RegisterClientScriptBlock的语义相同,但不是大页面顶部给出脚本,而是在底部给出脚本.那么控件产生的脚本还可以引用页面中提供的标签.

IsStartupScriptRegister: [bool IsStartupScriptRegister(string key)]和IsClientScriptBlockRegister的语义相同.

RegisterArrayDeclaraoon: [void RegisterArrayDeclaraoon(string arrayName,string arrayValue)] 使用该方法,控件可以在指定的数组中发布值.页面在客户端脚本中用在arrayName中给出的名字创建一个数组变量,它包含了在同一arrayValue注册过的所有值,这样控件的所有实例都可以往这个数组或值的列表中添加值,以后控件产生的客户端脚本就可以很容易地处理.

RegisterHiddenField: [void RegisterHiddenField(string hiddenFieldName,string initialValue)]具使用该方法,控件可以提供一个隐藏域,当页面提交的时候,通过客户端脚本可以访问该域并将它的值提交给服务器.

RegisterOnSubmitStatement: [void RegisterOnSubmitStatement(string key,string script)] 页面被提交的时,该方法用来注册需要执行的指定的脚本语句.这样控件在客户端的行为可以参与提交过程.

Public Shared Function BrowserSupportsFunctionality(ByVal eFunctionality As DotNetNuke.UI.Utilities.ClientAPI.ClientFunctionality) As Boolean该方法用来检查浏览器是否支持某种格式如(DHTML)eg.ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML)

Public Shared Sub RegisterClientReference(ByVal objPage As System.Web.UI.Page, ByVal eRef As DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences)该方法用来注册命名空间eg.ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn_mydnn)




原文地址:https://www.cnblogs.com/zgqys1980/p/684278.html