Ok, it's a code.
I have a simple control with the following button:
<asp:Button ID="btnCancel" runat="server" Resourcekey="Cancel" OnClick="Cancel_Click" />
It's Cancel_Click function.
protected void Cancel_Click(object sender, EventArgs e)
{
Utils.RedirectToTab("//BusinessUnitEdit", "EditId=" + EditId);
}
It's RedirectToTab function
public static void RedirectToTab(string tabpath, string query)
{
int tabid = DotNetNuke.Entities.Tabs.TabController.GetTabByTabPath(0, tabpath);
if (tabid != -1)
{
string navurl = DotNetNuke.Common.Globals.NavigateURL(tabid, "", query);
HttpContext.Current.Response.Redirect(navurl);
}
}
By some reason GetTabByTabPath() function return -1 when I click on the button first time, so redirect
doesn't occures. When I click on the button second time function works well.
As far as I can see from DNN sources GetTabByTabPath() call GetTabPathDictionary() function.
It's a public function, so I tried to call it in my RedirectToTab() by the following way:
public static void RedirectToTab(string tabpath, string query)
{
Dictionary<string, int> TabPath = DotNetNuke.Entities.Tabs.TabController.GetTabPathDictionary();
int tabid = DotNetNuke.Entities.Tabs.TabController.GetTabByTabPath(0, tabpath);
if (tabid != -1)
{
string navurl = DotNetNuke.Common.Globals.NavigateURL(tabid, "", query);
HttpContext.Current.Response.Redirect(navurl);
}
}
I get an expected result, when I click on the button first time GetTabPathDictionary() return empty Dictionary.