DNN:在一个模块中使用多个Web用户控件并显示在不同的页面不同的控件 [英] DNN: Using multiple web user controls in one module and showing different controls in different pages

查看:326
本文介绍了DNN:在一个模块中使用多个Web用户控件并显示在不同的页面不同的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手DotNetNuke的。请温柔。我使用了DotNetNuke的6编译的模块模板建立我的模块。我已经在这个项目View.ascx控制,并增加了一个叫做test.ascx另一个控制

I'm a DotNetNuke newbie. Please be gentle. I'm using the "DotNetNuke 6 Compiled Module" template to build my module. I already have View.ascx control in the project and have added another control called test.ascx.

我的问题是:我怎么说明了在不同的页面不同的不同的看法我添加模块。 (如果这是可能的),
例如
显示View.ascx上说Default.aspx页,然后default2.aspx页上展示test.ascx用户控件?

My question is: how do I show different different views in different pages I add the module to. (if that is possible at all) e.g Show View.ascx on say the default.aspx page and then on the default2.aspx page show the test.ascx user control?

如果这是不可能的意思我需要为每个ascx控件不同的Visual Studio项目。 。当然不是

If this is not possible does it mean I need different visual studio projects for each ascx control. Surely not.

推荐答案

天文,

选项1:

您需要到主机>扩展>编辑extesion>扩展模块定义,然后单击添加控件。

You need to go to Host > Extensions > Edit your extesion > Expand Module definition and click on add control.

在这里,你可以选择你的ascx控件,并提供关键的任意字符串。比方说,你提供的密钥测试,您选择的用户控制和选择控制类型为视图并保存它。

Here you have to select your ascx control and provide key as any string. Let's say you provided key test, you selected user control and selected control type as view and saved it.

现在从视图中,您可以使用下面的代码浏览到新添加的控制:
DotNetNuke.Common.Globals.NavigateUrl(TabId,测试,年年=+的moduleId);

Now from view you can use following code to navigate to the newly added control: DotNetNuke.Common.Globals.NavigateUrl(TabId,"test","mid="+ModuleID);

这将重定向页面,并与test.ascx加载页

This will redirect the page and load your page with test.ascx.

当你想用默认显示view.ascx并希望在一些动作和表演test.ascx何时切换视图可以使用这种选项。这里的缺点是,当你切换到test.ascx,添加到页面中的所有其他模块是不可见的。

You can use this kind of option when you want to show view.ascx by default and want to switch view when on some action and show test.ascx. Disadvantage here is, when you switch to test.ascx, all other modules added to page will not be visible.

选项2:

您必须创建模块一个新的定义。对于进入主机>扩展>编辑您的模块>展开模块Definitoins>点击Add并添加新的定义。一旦定义添加,您可以在test.ascx和视图控件添加到没有任何按键的定义。

You have to create a new definition in module. For that go to Host > Extensions > Edit Your module > Expand Module Definitoins > Click on add and add new definition. Once definition is added, you can add your test.ascx and view control to the definition without any key.

在上面完成,如果你删除和你的模块添加到再次页面,它会显示在页面中添加了两个模块。这是两个定义。再看例如定义如何将多个工作原理的博客模块定义。

Once above is done, if you delete and add your module to page again, it will show two modules added in the page. These are two definitions. Look at the blog module definition for example of how multiple definitions works.

当你想显示从同一模块,同时多个视图控件使用此选项。

This option is used when you want to show multiple view control at the same time from the same module.

我希望这有助于。让我知道如果你有任何问题。

I hope this helps. Let me know if you have any more questions.

这篇关于DNN:在一个模块中使用多个Web用户控件并显示在不同的页面不同的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆