Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing site in visual studio 2012 MVC 4 razor .. and want to use listview with update panel ..

also i want to use asp:checkbox control with onselectedindexchange ...................

how to do this..pls provide example code
Posted
Updated 1-May-14 23:41pm
v2

1 solution

This isn't going to be what you want to hear: asp.net controls you meantioned aren't really available in MVC. You are going to need to re-adjust your thinking when using MVC.
ASP.NET basically coerced a Winforms style architecture into the webforms environment, so controls had events that automagically ended up on the server (at least if you do it correctly :))

MVC works much more closely with standard web technology, so the way to think of it the razor is as generating "pure" HTML pages and the controllers handle web requests. In many ways this us better IMO, but some people disagree this is the case with Web apps, you pay your money, you take your choice.

To acheive what you want:

Use a standard HTML Checkbox on the page

  1. Include JQuery[^] to your page if you haven't already.
  2. Use Jquery to fire code. [^].
  3. In MVC it is possible to return something other than a whole page, and will service AJAX calls. A The code in the step above should make an AJAX call to the server, an example here[^]
  4. Once the response is got from the server, use jquery to update the UI!
 
Share this answer
 
Comments
maulikshah1990 5-May-14 2:50am    
can u give proper example to understand above........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900