how to set tab index radmultipage when postback occurs dynamically?
Code
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" OnTabClick="RadTabScript1_TabClick" OnClientTabSelecting="onTabSelecting" > <%-- OnClientTabSelecting="onTabSelecting"> --%>
<Tabs>
<telerik:RadTab Text="Resources" runat="server" TabIndex="0" Selected="true" PageViewID="radPageResources"></telerik:RadTab>
<telerik:RadTab Text="Tasks" runat="server" TabIndex="1" PageViewID="radPageTasks"></telerik:RadTab>
<telerik:RadTab Text="Messages" runat="server" TabIndex="2" PageViewID="radPageMessages"></telerik:RadTab>
<telerik:RadTab Text="Files" runat="server" TabIndex="3" PageViewID="radPageFiles"></telerik:RadTab>
<telerik:RadTab Text="Feedback" runat="server" TabIndex="4" PageViewID="radPageFee开发者_运维问答dback"></telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" OnPageViewCreated="RadMultiPage1_PageViewCreated" SelectedIndex="0" > <%-- RenderSelectedPageOnly="true" > --%>
<telerik:RadPageView ID="radPageResources" runat="server" TabIndex="0">
<telerik:RadGrid runat="server" ID="grdResource" PageSize="5" Skin="Default" AllowPaging="True"
AllowSorting="true" ShowFooter="true" AutoGenerateColumns="False" Width="97%"
OnItemCreated="grdResource_ItemCreated" OnNeedDataSource="grdResource_NeedDataSource"
OnDeleteCommand="grdResource_DeleteCommand" ShowStatusBar="True" GridLines="None"
OnItemDataBound="grdResource_ItemDataBound">
</telerik:RadGrid>
Like this i have 4 pageview tabs with indexes and every pageview tab contains a grid.If suppose i did changes in some x-grid and causes postback,then i need the x-grid should be shown after the postback. But i was showing the Resourcegrid.
codebehind
protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
RadMultiPage1.SelectedIndex = e.PageView.TabIndex;
}
but this event not firing in any case.
so how can i come back to the previous grid even when postback occurs?try set selected index in page_prerender.
protected void Page_PreRender(object sender, EventArgs e)
{
//RadTab t1 = new RadTab();
//RadMultiPage m1 = new RadMultiPage();
m1.SelectedIndex = t1.SelectedIndex;
}
i don't know my solution can be helpful for this subject or not I tried all methods and finally find myself method,
i suggest if your problem not solved make java script function and then call it from code behind My Sample :
function OnClientClick1(i) {
var tabstrip1 = $find("<%=RadTabStrip1.ClientID %>");
tabstrip1.set_selectedIndex(1);
}
and then make function on your code to call that
private void ChangeTab(int index)
{
string scriptyKey = "Alert" + Guid.NewGuid().ToString().Replace("-", "_");
ScriptManager.RegisterStartupScript(Page, Page.GetType(), scriptyKey, "OnClientClick1("+index.ToString()+");", true);
}
I hope be useful
精彩评论