Changing Listview between showing pictures and grid-like view

4 posts, 0 answers
  1. Tonyz289
    Tonyz289  avatar
    50 posts
    Member since:
    Jun 2011

    Posted 26 Jan 2012 Link to this post

    How do I switch between showing a Listview with pictures to a more grid0like view. It must use JavaScript and/or Ajax not repaint the whole screen.
  2. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 31 Jan 2012 Link to this post

    Hello,

    To change the visual representation of the RadListView control you should change its ItemTemplate. Currently RadListView does not support changing the ItemTemplate on the client with JavaScript. You should do this on server side programmatically like described here.

    Another approach is to have two sets of controls and based on some condition you could switch these two sets accordingly. However, this approach could cause layout problems and misalignment of the included elements.

    The easiest approach is to create the structure of the RadListView control programmatically and thus you could fine tune what to be shown. The process of switching the sets could be made by an Ajax call to the server.

    All the best,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tonyz289
    Tonyz289  avatar
    50 posts
    Member since:
    Jun 2011

    Posted 31 Jan 2012 Link to this post

    The process of switching the sets could be made by an Ajax call to the server. Do you have an example of this? I am unsure how and switch sets under Ajax.
  5. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 31 Jan 2012 Link to this post

    Hi,

    Switching sets of controls is an abstract term. It means that you need to have two different setups of RadListView controls that depends on some input control(button or similar control) state. When the state of the input control is changed you could make a postback to the server, then based on the value of this control you will choose which setup of the control to create and thus you will end up with "different" control.

    More about this approach could be found in the article I have sent you in my previous reply.

    Kind regards,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top