How to Load on Demand RadPageView

9 posts, 1 answers
  1. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 15 Apr 2010 Link to this post

    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);

    }

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 20 Apr 2010 Link to this post

    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.
  3. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 20 Apr 2010 Link to this post

    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.
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Apr 2010 Link to this post

    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.
  5. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 23 Apr 2010 Link to this post

    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.
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 29 Apr 2010 Link to this post

    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.
  7. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 29 Apr 2010 Link to this post

    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
  8. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 May 2010 Link to this post

    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.
  9. Jorge Cardenas
    Jorge Cardenas avatar
    12 posts
    Member since:
    Jan 2010

    Posted 05 May 2010 Link to this post

    Thanks Peter the workaround to the javascript bug worked.

    -Jorge
Back to Top