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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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
jamesbaileCommented:
Have a look here for details about the YUI datatable

http://developer.yahoo.com/yui/datatable/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Frameworks

From novice to tech pro — start learning today.