使用 EditURL() 或 NavigateURL() 在 DotNetNuke 模块控件之间导航
好的,我是 DotNetNuke 的新手,需要在 DNN 中编写一个简单的模块,该模块将为每个人显示一篇文章,并允许管理员编辑该文章/添加新文章。
我有一个测试页,其中包含一个 DNN 模块,该模块具有一个模块定义和该定义中的两个控件。默认控件根据查询字符串中的articleID字段显示文章。然后,您单击一个应该加载编辑控件的按钮并在查询字符串中传递articleID。
如果我在 onClick 中使用 EditURL()
,编辑控件将加载正确的articleID,但使用管理皮肤。如果我使用 Globals.NavigateURL() 则会显示正确的皮肤,但我的编辑控件未加载到页面中。
关于如何我做错了什么或如何使用正确的皮肤加载编辑控件有任何线索吗?
下面列出了我切换到编辑控件(在我的按钮单击事件中)的两种方法:
string newURL = this.EditUrl("articleID", Request.QueryString["articleID"], "EditArticle");
Response.Redirect(newURL);
和
string newURL = Globals.NavigateURL(this.TabId, "EditArticle","articleID="+Request.QueryString["articleID"]);
Response.Redirect(newURL);
OK I'm new to DotNetNuke and need to write a simple module in DNN that will display an article for everyone, and allow the admin to edit the article/add a new one.
I have a test page that contains a DNN module with one module definition and two controls in that definition. The default control shows the article based on an articleID field in the querystring. You then click a button that is supposed to load the edit control and pass the articleID in the query string.
If I use EditURL()
in the onClick the edit control is loaded with the correct articleID, but using the admin skin. If I use Globals.NavigateURL()
then the correct skin is shown but my edit control isn't loading in the page.
Any clue as to how to what I'm doing wrong or how to get the edit control loading with the correct skin?
My two methods of switching to the edit control (in my button click event) are listed below:
string newURL = this.EditUrl("articleID", Request.QueryString["articleID"], "EditArticle");
Response.Redirect(newURL);
and
string newURL = Globals.NavigateURL(this.TabId, "EditArticle","articleID="+Request.QueryString["articleID"]);
Response.Redirect(newURL);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您的做法是正确的 - DNN 中的 editurl 确实会加载管理皮肤 - 通常该皮肤基于管理内容的人员,因此它会删除所有其他模块并显示“基础知识”。无论对与错,这就是它的作用。
如果您不想这样做,您可以在查询字符串中提供一个开关并显示单独的面板,或者执行多视图控制并根据查询字符串中的开关显示不同的视图。
还有一些其他方法,例如将内容区域更改为使用 ajax 编辑文本区域或使用弹出模式样式窗口。
Actually you are doing this correctly - the editurl in DNN does load the Admin skin - usually this skin is based on someone administering content so it strips out all other modules and shows the 'basics'. Right or wrong this is what it does.
If you dont want to to do that you could provide a switch in the querystring and show a seperate panel or do a multiview control and show different views based on the switch in the query string.
There are a few other approaches like changing the content area to editing text area with ajax or using popup modal style windows.