Hi,
I've implemented a load-on-demand radtabstrip with radmultipage using the telerik demo. This works fine. Each tab shows an ascx control which holds a different Radgrid.
I then tried to implement the RenderSelectedPageOnly by setting this to "true" & setting AutoPostBack to "true" on the TabStrip.
However, this did not work. When i load my page, the default tab loads & when i click on to another tab then this loads correctly.
BUT if i click back on to a tab i already viewed, it displays a blank tab with no radgrid. I tried to trace the AutoPostBack but it does not seem to be firing.
All i want to do is render the selected page of the TabStrip but when another tab is selected (regardless of whether it has been rendered before) load the newly clicked Tabs page contents.
My code is as follows:
HTML:
JAVASCRIPT:
.CS
Can anyone tell me what i'm doing wrong or why the autopostback is not firing when a viewed tab is selected again?
Is there a different way of getting the TabStrip to render selected page only but reload a different tab when clicked on?
Regards,
Shuja
I've implemented a load-on-demand radtabstrip with radmultipage using the telerik demo. This works fine. Each tab shows an ascx control which holds a different Radgrid.
I then tried to implement the RenderSelectedPageOnly by setting this to "true" & setting AutoPostBack to "true" on the TabStrip.
However, this did not work. When i load my page, the default tab loads & when i click on to another tab then this loads correctly.
BUT if i click back on to a tab i already viewed, it displays a blank tab with no radgrid. I tried to trace the AutoPostBack but it does not seem to be firing.
All i want to do is render the selected page of the TabStrip but when another tab is selected (regardless of whether it has been rendered before) load the newly clicked Tabs page contents.
My code is as follows:
HTML:
<
telerik:RadTabStrip
OnClientTabSelecting
=
"onTabSelecting"
ID
=
"RadTabStrip1"
SelectedIndex
=
"0"
runat
=
"server"
MultiPageID
=
"RadMultiPage1"
OnTabClick
=
"RadTabStrip1_TabClick"
Width
=
"900px"
AutoPostBack
=
"true"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
OnPageViewCreated
=
"RadMultiPage1_PageViewCreated"
Width
=
"900px"
RenderSelectedPageOnly
=
"true"
>
</
telerik:RadMultiPage
>
JAVASCRIPT:
function
onTabSelecting(sender, args) {
if
(args.get_tab().get_pageViewID()) {
args.get_tab().set_postBack(
false
);
}
}
.CS
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
AddTab(
"MyForms"
);
AddPageView(RadTabStrip1.FindTabByText(
"MyForms"
));
AddTab(
"MyApprovals"
);
AddTab(
"MySystemsApprovals"
);
AddTab(
"MyGateKeeperApprovals"
);
}
}
private
void
AddTab(
string
tabName)
{
RadTab tab =
new
RadTab();
tab.Text = tabName;
RadTabStrip1.Tabs.Add(tab);
}
private
void
AddPageView(RadTab tab)
{
RadPageView pageView =
new
RadPageView();
pageView.ID = tab.Text;
RadMultiPage1.PageViews.Add(pageView);
pageView.CssClass =
"pageView"
;
tab.PageViewID = pageView.ID;
}
protected
void
RadTabStrip1_TabClick(
object
sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab);
e.Tab.PageView.Selected =
true
;
}
protected
void
RadMultiPage1_PageViewCreated(
object
sender, RadMultiPageEventArgs e)
{
string
userControlName = e.PageView.ID +
"CS.ascx"
;
Control userControl = Page.LoadControl(userControlName);
userControl.ID = e.PageView.ID +
"_userControl"
;
e.PageView.Controls.Add(userControl);
}
Can anyone tell me what i'm doing wrong or why the autopostback is not firing when a viewed tab is selected again?
Is there a different way of getting the TabStrip to render selected page only but reload a different tab when clicked on?
Regards,
Shuja