how do i integrate ListView with ASP.net MVC 2 ???

hi i want to integrate listview with mvc application that i have .. i dont know if it is possible since the Listview is a Server Side component. actually i did found a post about it here but i didnt work with me i dont know what is wrong
LVL 1
VCyrusAsked:
Who is Participating?
 
jamesbaileConnect With a Mentor Commented:
Have a look here for details about the YUI datatable

http://developer.yahoo.com/yui/datatable/
0
 
jamesbaileCommented:
Using server side controls in MVC negates the point of MVC - clear separation of concerns. Therefore it is definately not a recommended approach.

I tend to simply code the table in my view

<table>
<% foreach(var item in Model.ListOfItems) { %>
<tr>
  <td><%= item.MyProperty %></td>
  <td><%= item.AnotherProperty %></td>
</tr>
<% } %>
</table>

However there are a number of MVC controls which use HTML helper extension methods, including in the MVC contrib project.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
turkserdarCommented:
just want to add james comment. if you create a custom View make sure to use IEnumerable to use foreach loop. MVC great for performance and expandibility.
0
 
VCyrusAuthor Commented:
hi all ,,
thanks for replying ..

@tbsgadi: the controls u pointed me at is a whole new story i want simpler solution to work listview in my project not to add new control .. but thanks anyway .. great tool over there .

@jamesbaile: this is basic thing u showed i know how to do that ,, and by the way it is better to html.encode ( item.property ) ,

i want to use listview so i can get use of its features like sorting and paging .

0
 
jamesbaileCommented:
Yes. I agree about the Html.Encoding bit - my examples are not production grade, just examples to demonstrate the principles.

If you are doing MVC then I'd really caution against using standard ASP.NET controls in your views. Just becase it's possible does not mean you should do it. If you want to use ListViews and that's the best thing for your application then you should use standard ASP.NET. However there are many options for displaying tabular data in grids - in one application I am developing I am using Yahoo YUI DataTables hooked up to MVC controllers. The grids are 100% ajax and handle sorting, paging etc.


0
 
VCyrusAuthor Commented:
thnx jamesbaile  for replying  .. i am not criticizing ur code here or anything ..
if u can demontrate that pls cuz i am new to this ajax stuff ..or where i can find some basic or advanced tutorial ... i really appreciate ur effort to help
0
 
VCyrusAuthor Commented:
sorry i have not replied  but i have been so busy test stuff out .. i figured out that ExtJs Framework is the best( for those who have experience with JavaScript) also better than jquery...  nice Framework from yahoo as pointed jamesbaile ..
but after all i think i will stick to Telerik ASP.net web controls ... it is much easier to manage the code and i wont be disturbe with so much JavaScript Code.
0
All Courses

From novice to tech pro — start learning today.