简体   繁体   中英

C# Question With Telerik RadTabStrip

So I have a telerik RadTabStrip with RadViews I think it's called. The thing is when I am in the fourth tab and I click any button or link there it posts back and sends me to the first tab but I don't want that, this actually happens when I am clicking a button to delete something, it deletes it but when postback goes back to the first tab so I have to go back to the fourth tab to make sure it deleted. I know it is in my pageload.. How can I improve it?

Thank you

protected void Page_Load(object sender, EventArgs e)
{
    if (Request.QueryString["BooksID"] != null)
    {
        btnSubmit.Text = "Plus";
        btnOtherSubmit.Text = "Plus";
        theID = Convert.ToInt32(Request.QueryString["BookID"]);
    }
    else
    {
        btnSubmit.Text = "Minus";
        btnPtherSubmit.Text = "Minus";
        clientID= 0;            
    }

    if (Request.UrlReferrer != null)
    {
        if (Request.UrlReferrer.AbsoluteUri.Contains("Page1.aspx"))
        {
            MyMultiView.SelectedIndex = 1;
            TabStrip.SelectedIndex = 1;
        }

        else if(Request.UrlReferrer.AbsoluteUri.Contains("Page2.aspx"))
        {
            PersonalizationMultiView.SelectedIndex = 2;
            TabStrip.SelectedIndex = 2;
        }
        else
        {
            MyMultiView.SelectedIndex = 0;
            TabStrip.SelectedIndex = 0;
        }
    }

    if (!IsPostBack)
    {
       BindField(BookStoreID);

       if (theID > 0)
       {
           BindPr(theID);
       }
    }

}

The RadTabStrip doesn't just reset back to the original tab; it's pretty good at keeping its position. I've never had that issue, only when I wrote code to explcitly change the tab/page view.

The issue is your Request.UriReferrer references is not wrapped with !Page.IsPostBack, so it always sets the first or second tab.

HTH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM