This is a migrated thread and some comments may be shown as answers.

How to Load on Demand RadPageView

8 Answers 449 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Jorge Cardenas
Top achievements
Rank 2
Jorge Cardenas asked on 15 Apr 2010, 04:30 PM

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

Sort by
0
Peter
Telerik team
answered on 20 Apr 2010, 02:34 PM
Hello Jorge,

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.
0
Jorge Cardenas
Top achievements
Rank 2
answered on 20 Apr 2010, 03:47 PM
Thanks Peter it worked! But I have another problem.

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.
0
Peter
Telerik team
answered on 23 Apr 2010, 09:46 AM
Hi Jorge,

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.
0
Jorge Cardenas
Top achievements
Rank 2
answered on 23 Apr 2010, 05:00 PM
Hi Peter I have attached the error that I am getting and have submitted a ticket with a code sample that creates the problem on my side  under IE and Firefox. Please see the following ticket ID : 303480 for the sample app.

Thanks.
0
Peter
Telerik team
answered on 29 Apr 2010, 08:59 AM
Hello Jorge,

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.
0
Jorge Cardenas
Top achievements
Rank 2
answered on 29 Apr 2010, 03:48 PM
Hi Peter, I saw the screen cast and the only thing I do different is go direct to that page off a link passing in a PageIndex in the querystring. When I pass in a PageIndex I get the error.

sample link:
http://localhost:49573/default.aspx?PageIndex=2
0
Accepted
Peter
Telerik team
answered on 05 May 2010, 12:11 PM
Hi Jorge,

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.
0
Jorge Cardenas
Top achievements
Rank 2
answered on 05 May 2010, 03:33 PM
Thanks Peter the workaround to the javascript bug worked.

-Jorge
Tags
TabStrip
Asked by
Jorge Cardenas
Top achievements
Rank 2
Answers by
Peter
Telerik team
Jorge Cardenas
Top achievements
Rank 2
Share this question
or