如何在DotnetNuke中重定向到另一个View(UserControl'.ascx')? [英] How to redirect to another View(UserControl '.ascx') in DotnetNuke?

查看:81
本文介绍了如何在DotnetNuke中重定向到另一个View(UserControl'.ascx')?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是DotnetNuke的新手.我不了解DotnetNuke的所有术语.请纠正我.那将帮助我改善.

I am new in DotnetNuke. I don't know all the terminology of DotnetNuke. Please correct me. That will help me to improve.

我已经用2个UserControl创建了一个简单项目. 1- View.ascx,2- ModuleInfo.ascx

I have create a Simple Project with 2 UserControl. 1- View.ascx, 2- ModuleInfo.ascx

1- View.ascx: 它包含一个按钮.我想将其重定向到另一个用户控件ModuleInfo.ascx 这是代码.

1- View.ascx: It contains a button. I want to redirect it to another User Control ModuleInfo.ascx Here is code.

protected void btn1_Click(object sender, EventArgs e)
{
    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("ModuleInfo"), true);
}

2- ModuleInfo.ascx 它包含静态表.

2- ModuleInfo.ascx It contains static table.

我如何将模块添加到DotnetNuke:

How I added Module to DotnetNuke:

1- Add .zip file of build project to Admin --> Extension
2- Edit Module from Host --> Extension --> Edit Module --> Edit Definition --> Add Module Control --> Added key "ModuleInfo" and selected view.
3- Created new page and added module to it. 

页面加载时,View.aspx可以.有一个按钮.但是,当我单击按钮时,它将重定向到某个页面,但它为空白.它应该显示表格.

When page load, View.aspx is fine. There is a button. But when I click on button, it will redirect to some page but it is blank. It should show the Table.

如果我在这里想念任何东西,有人可以建议我吗?

Can anybody please suggest me if I am missing anything here?

推荐答案

NavigateUrl必须在附加参数中包含tabId和moduleId才能起作用.导航到模块内部视图的更简单方法是使用base.EditUrl(),该方法只需要视图的controlKey.参见下面的代码片段,设置miUrl的两行都是等效的.

NavigateUrl must include tabId and moduleId in the additional arguments in order to work. A simpler method for navigating to views inside your module is simply use the base.EditUrl() which only needs the view's controlKey. See the below code snippet, both lines that set miUrl are equivalent.

protected void btn1_Click(object sender, EventArgs e)
{
    string miUrl = base.EditUrl("ModuleInfo");
    string miUrl = DotNetNuke.Common.Globals.NavigateURL(base.TabId, "ModuleInfo", String.Format("mid={0}", base.ModuleId));

    Response.Redirect(miUrl, true);
}

这篇关于如何在DotnetNuke中重定向到另一个View(UserControl'.ascx')?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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