C# Question With Telerik RadTabStrip
So I have a telerik 开发者_如何学PythonRadTabStrip 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.
精彩评论