开发者

TabStrip issue on postback

开发者 https://www.devze.com 2023-04-07 13:22 出处:网络
I have a page and in the page I have a RadTabStrip, it has a MultiView with two in开发者_如何学运维dexes and two TabStrip indexes. The problem I am having is that when i update something in the second

I have a page and in the page I have a RadTabStrip, it has a MultiView with two in开发者_如何学运维dexes and two TabStrip indexes. The problem I am having is that when i update something in the second index, it returns back to the first index on postback.

So I added a parameter in the url called &mode=Updated so on load if it cones wuth that string I make it stay in that page.. that works..

The problem now is that when I go to the first tab, anything that posts back there causes to read the same parameter and it comes back on the second tab now.. lol ... So I am not sure how to do this...

Please help

**THIS CODE IS OUTSIDE THE 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;
            }
        }


Be sure to only adjust you RadTabStrip if the page isn't posting back.

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

精彩评论

暂无评论...
验证码 换一张
取 消