Visibility of pages and their location

10 posts, 1 answers
  1. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 14 Oct 2010 Link to this post

    Hi,

    How would one go about programmatically setting the visibility of pages at run time and also is there a way to set the position of the pages along the rows? (i.e. can one page be set to the far right).

    Kind regards,


    Guy

  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Oct 2010 Link to this post

    Hello,

    I have prepared a short example, that should answer all of your questions:
    var pageView = new RadPageView();

    var page1 = new RadPageViewPage()
    {
        Text = "Page1"
    };
    var page2 = new RadPageViewPage()
    {
        Text = "Page2"
    };
     
    pageView.Pages.Add(page1);
    pageView.Pages.Add(page2);
     
    // to swap pages
    pageView.Pages.Swap(page1, page2);
     
    // to move page to another index
    pageView.Pages.ChangeIndex(page1, newIndex);
     
    // to move page to the last index
    pageView.Pages.ChangeIndex(page1, pageView.Pages.Count - 1);
     
    // to close it you have to remove it (sorry no other way that i could find)
    pageView.Pages.Remove(page1);

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  3. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 14 Oct 2010 Link to this post

    Emanuel,

    Thanks for taking the time out to responde, much appreciated.

    Although your answer will be helpful for the future it unfortunately doesn't answer my question which I suspect is to do with my explanation, so i'll try to go a bit more indepth as to what i'm hoping to achieve.

    With regards to the page position, what I would like to do is have a page which is alinged to the very right of the PageView whilst the others are still aligned to the left.

    An example would be

    |Page 1\ Page 2\ Page 3\                                                                Page 4\|
    |--------------------------------------------------------------------------------------------|

    If this cannot be achieved, how about a custom button added where the strip menu is? I'm looking to add as to see help button to my project.

    Regarding the hidden pages, my users have to log in to the system and I don't want them to be able to view all the other tabs without logging in first. If I am unable to hide the other pages until a user has logged in, is there a way to block access to the pages until the log in has been complete?

    Regards,

    Guy

  4. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Oct 2010 Link to this post

    Hello again,

    Sorry, first thing cannot be achieved in the current version, maybe they will add this functionality in the future.

    For the second part, you can register to the SelectedPageChanging event and use e.Cancel = true; to cancel the the operation if the user is not logged in, for instance.

    Best Regards,
    Emanuel Varga
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Oct 2010 Link to this post

    I forgot about the help button, by default you cannot do this, but if you really want to, i will try to find a way, by using a RadPageView inherited control.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  6. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 15 Oct 2010 Link to this post

    Thanks again for both your replies.

    I think i'm going to opt for a help button on the home page as it'll be easier.

    I also believe your suggestion for the log in restrictions would be the cleaner way of doing things; could you perhaps expand on what you mean though as I'm pretty new to all this, sorry.

    Many thanks,

    Guy
  7. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 15 Oct 2010 Link to this post

    Hello again,

    You should register to the SelectedPageChanging in the RadPageViewControl,

    After that, inside that event you could do something like the following:
    void pageView_SelectedPageChanging(object sender, RadPageViewCancelEventArgs e)
    {
        if (!loggedIn)
        {
            // calling e.Cancel = true here, will cancel the changing of the page, thus the user will remain on the current page
            e.Cancel = true;
        }
    }

    Please let me know if this is OK for you and please don't hesitate to say so if you have any other questions.

    Best Regards,
    Emanuel Varga
  8. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 16 Oct 2010 Link to this post

    Hi,

    Sorry for getting back to you late. That worked perfectly!

    Thank you very much for your help.

    Guy
  9. Aggelos
    Aggelos avatar
    1 posts
    Member since:
    Jul 2018

    Posted 31 Jul 2018 Link to this post

    hello,

    i would like to make pageview in which i have 3 button and each time user push it i load from my database a different datatable.How can i create each table with grid to open and hide it every time?

     

  10. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3204 posts

    Posted 01 Aug 2018 Link to this post

    Hello, Aggelos,    

    You can add a RadGridView programmatically to the page when you click the button. I have prepared a sample project for your reference demonstrating how to fill a dummy DataTable and bind the grid to it. 

    I hope this information helps. 

    Regards,
    Dess
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top