Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

DNN Tips(DNN技巧集-持续更新中)

$
0
0
1.Cache处理泛型方法Get/Set
DotNetNuke.Common.Utilities.DataCache.GetCache
DotNetNuke.Common.Utilities.DataCache.SetCache

2.得到当前模块的View url
DotNetNuke.Common.Globals.NavigateUrl(TabId)

3.模块的异常处理代码
DontNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException

4.获取不包含管理员页面的集合
Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true, false, true);


5.DNN下载文件的方法,其中第一个参数为FileID=7这种格式:
Response.Redirect(Globals.LinkClick(crlist[i].URL, TabId, ModuleId, false, true));

6.绑定国家列表:
                                ListController listcontr = new ListController();

                                ListEntryInfoCollection listentries = listcontr.GetListEntryInfoCollection("Country");

                                drpText1.DataSource = listentries;

                                drpText1.DataValueField = "Value";

                                drpText1.DataTextField = "Text";

                                drpText1.DataBind();


7.通过EventLog添加记录

                         //Event

                         DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

                         DotNetNuke.Services.Log.EventLog.LogInfo objEventLogInfo = new DotNetNuke.Services.Log.EventLog.LogInfo();

                         objEventLog.AddLog("Sample Message", ReferrerURL, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

8.DNN 模块快速安装多个模块
你还因为DNN站点多个模块用默认上传模块方式繁琐的步骤而烦恼吗?现在告诉大家一个批量上传DNN模块的方法,只需要几秒钟就完成,几分钟或许是十几分钟的操作,从而提高你的工作效率。如下:

          1.首先把所有模块PA包放在domain/install/module/文件夹下(domain表示你的网址)

          2.然后在浏览器中输入http://domain/install/install.aspx?mode=installresources 。

          3.所有模块将会自动安装。

9.DNN模块引用模块中的图片
a.如果你正在使用控件,那么你可以用以下方式指定:
imageurl="~/desktopmodules/【MODULENAME】/images/imagename.gif"
b.如果你是在模块代码中需要引用模块本地图片,那么你可以参照如下代码片段:
string fileUrl= "http://" + this.PortalSettings.PortalAlias.HTTPAlias + "desktopmodules/modulename/+ "image.gif";
c.如果你想在模块前台ascx文中中动态引用css片段,并且该css片段需要引用本地模块图片,那么你参考如下CSS片段:
background: url("desktopmodules/【MODULENAME】/images/xx.jpg") no-repeat 0px 0px; 


作者:missautumn 发表于2013-11-23 0:13:37 原文链接
阅读:0 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>