回发时的TabStrip问题

本文关键字:TabStrip 问题 | 更新日期: 2023-09-27 18:09:21

我有一个页面,在页面中我有一个RadTabStrip,它有一个MultiView与两个索引和两个TabStrip索引。我遇到的问题是,当我更新第二个索引中的内容时,它会在回发时返回到第一个索引。

所以我在url中添加了一个名为&mode=Updated的参数,所以在加载时,如果它与那个字符串匹配,我让它留在那个页面。工作. .

现在的问题是,当我去到第一个选项卡,任何帖子回到那里导致读取相同的参数,它回到第二个选项卡现在。哈哈所以我不确定如何做到这一点…

请帮

**此代码在if(!Page.IsPostBack)

之外
 if (Request.UrlReferrer != null)
        {
            if (Request.UrlReferrer.AbsoluteUri.Contains("myPage.aspx"))
            {
                MyMultiView.SelectedIndex = 1;
                MyTabStrip.SelectedIndex = 1;
            }
            else if (!String.IsNullOrEmpty(pageKey))
            {
                switch (pageKey)
                {
                    case "updated":
                        LabelT.Text ="Updated Successful";
                        break;
                    case "error":
                        LabelT.Text ="There was an error";
                        break;
                   default:
                        LabelT.Text = string.Empty;
                        break;
                }
                MyMultiView.SelectedIndex = 1;
                MyTabStrip.SelectedIndex = 1;
                pageKey = string.Empty;
            }
            else
            {
                MyMultiView.SelectedIndex = 0;
                MyTabStrip.SelectedIndex = 0;
            }
        }

回发时的TabStrip问题

请确保仅在页面不返回时才调整RadTabStrip。

If (!Page.IsPostBack){
//Adjust here
}