Hi All, I am following the Load on Demand RadPageView example and everything is working correctly except for the fact that I am trying to load PageIndex 2 and show PageIndex 2. When I do this the tab shows up blank as if nothing was loaded. I believe the actual tab is loading but at index 0, any guidance or a how to will be much appreciated.
Thanks
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
AddTab(
"General Information");
AddTab(
"Change Password");
AddTab(
"Quick Links");
AddTab(
"Application Access");
int i = -1;
if (Request.QueryString["PageIndex"] != null)
Int32.TryParse(Request.QueryString["PageIndex"], out i);
switch (i)
{
case 2:
RadMultiProfile.SelectedIndex = 2;
RadTabProfile.SelectedIndex = 2;
AddPageView(RadTabProfile.FindTabByText(
"Quick Links"));
break;
default:
AddPageView(RadTabProfile.FindTabByText(
"General Information"));
break;
}
}
}
private void AddTab(string tabName)
{
RadTab tab = new RadTab();
tab.Text = tabName;
RadTabProfile.Tabs.Add(tab);
}
private void AddPageView(RadTab tab)
{
RadPageView pageView = new RadPageView();
pageView.ID = tab.Text;
RadMultiProfile.PageViews.Add(pageView);
tab.PageViewID = pageView.ID;
}
protected void RadTabProfile_TabClick(object sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab);
e.Tab.PageView.Selected =
true;
}
protected void RadMultiProfile_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
string userControlName = "Controls/" + e.PageView.ID.Replace(" ", "") + ".ascx";
Control userControl = Page.LoadControl(userControlName);
userControl.ID = e.PageView.ID +
"_userControl";
e.PageView.Controls.Add(userControl);
}
8 Answers, 1 is accepted
With the Load on Demand RadPageView demo, you need to modify the code as follows to achieve this requirement:
protected
void
Page_Load(
object
sender, System.EventArgs e)
{
if
(!Page.IsPostBack)
{
AddTab(
"Customers"
);
AddTab(
"Products"
);
AddPageView(RadTabStrip1.FindTabByText(
"Products"
));
AddTab(
"Orders"
);
RadTabStrip1.SelectedIndex = 1;
RadMultiPage1.SelectedIndex = 0;
}
}
Note that SelectedIndex of RadMultiPage has to be set to 0, because when AddPageView() is executed and the PageView is added, its index automatically becomes 0.
private
void
AddPageView(RadTab tab)
{
RadPageView pageView =
new
RadPageView();
pageView.ID = tab.Text;
RadMultiPage1.PageViews.Add(pageView);
pageView.CssClass =
"pageView"
;
tab.PageViewID = pageView.ID;
}
Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Within that same page I have required field validator and the application throws a random javascript error (Expected ';'). As soon as I take out all the validators the page is fine with no javascript errors. Please help.
--Update: Actually none of the client side validation works in IE or Firefox.
Thanks.
I tried to reproduce the error by placing a RequiredFieldValidator control in the aspx page of the demo, but to no avail. Everything worked smoothly on my end.
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ControlToValidate
=
"TextBox1"
ErrorMessage
=
"RequiredFieldValidator"
>
How exactly do you use validators in your page?
Kind regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks.
We replied to your ticket. The problem still cannot be replicated on our side even with the sample you provided.
Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
sample link:
http://localhost:49573/default.aspx?PageIndex=2
It turned out that this is a known ASP.NET framework Client Validation Javascript Bug:
http://haacked.com/archive/2006/07/14/ASP.NET2.0ClientValidationJavascriptBug.aspx
For your case, the culprit is the empty space in the ID of the user control. Please, try modifying the code like so:
protected
void
RadMultiProfile_PageViewCreated(
object
sender, RadMultiPageEventArgs e)
{
string
userControlName = e.PageView.ID.Replace(
" "
,
""
) +
".ascx"
;
Control userControl = Page.LoadControl(userControlName);
userControl.ID = (e.PageView.ID +
"_userControl"
).Replace(
" "
,
""
);
e.PageView.Controls.Add(userControl);
}
Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
-Jorge