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

Changing Listview between showing pictures and grid-like view

3 Answers 38 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Tonyz289
Top achievements
Rank 1
Tonyz289 asked on 26 Jan 2012, 09:19 PM
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.

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 31 Jan 2012, 04:01 PM
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
0
Tonyz289
Top achievements
Rank 1
answered on 31 Jan 2012, 04:31 PM
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.
0
Andrey
Telerik team
answered on 31 Jan 2012, 06:23 PM
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
Tags
ListView
Asked by
Tonyz289
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Tonyz289
Top achievements
Rank 1
Share this question
or