0

我想使用标签 ID 而不是静态 URL 访问链接,因为我的 URl 是

Response.Redirect("~/Activities/Calendar.aspx?date=" + DateTime.Now.ToString("MM/dd/yyyy"))

我使用以下代码

Dim objModuleController As DotNetNuke.Entities.Modules.ModuleController
Dim objModuleInfo As DotNetNuke.Entities.Modules.ModuleInfo = objModuleController.GetModule(CInt(CType(Settings("DetailsCalendar"), Integer)))
Dim TabID As Integer = objModuleInfo.TabID

If CBool(CType(Settings("DetailsCalendar"), String)) Then
    Response.Redirect(NavigateURL(TabID, "date", DateTime.Now.ToString("MM/dd/yyyy")))
End If

但它将我重定向到错误的 URL 我做错了什么或如何编写它,我知道如何将 TabID 与 URL 一起使用

4

2 回答 2

1

If your control inherits "PortalModuleBase" it already has the TabId on it.

But the root cause of your issues with Navigate Url is that the structure that it has is similar to the following for the overload you are trying

NavigateUrl(int TabId, string contolKey, string[] params)

You need to pass the values so you are only appending the params

From your example you should be fine with

NavigateUrl(TabId, string.Empty, "date", DateTime.Now.ToString("MM/dd/yyyy"))

The key here is that you are not passing a control key.

于 2012-07-03T16:51:26.780 回答
0

这是使它起作用的正确代码:)

Dim objModuleController As New DotNetNuke.Entities.Modules.ModuleController
Dim objModuleInfo As DotNetNuke.Entities.Modules.ModuleInfo = objModuleController.GetModule(CInt(CType(Settings("DetailsCalendar"), Integer)))

If CBool(CType(Settings("DetailsCalendar"), String)) Then
IF (objModuleInfo.TabID <> 0 ) Then
Response.Redirect(NavigateURL(objModuleInfo.TabID, String.Empty ,"date="+ DateTime.Now.ToString("MM/dd/yyyy")))
End If
End If
于 2012-07-04T09:46:34.197 回答