listview / updatepanel in mvc razor 4 asp.net [英] listview/updatepanel in mvc razor 4 asp.net

查看:75
本文介绍了listview / updatepanel in mvc razor 4 asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发visual studio 2012 MVC 4 razor中的网站..并希望使用 listview 更新面板..



我也想用 asp:checkbox 控制 onselectedindexchange ........ ...........



怎么做...请提供示例代码

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

推荐答案

这不是你想听到的:asp.net控制你的意思是在MVC中真的不可用。使用MVC时,您需要重新调整思路。

ASP.NET基本上将Winforms风格的体系结构强制转换为webforms环境,因此控件具有自动结束服务器的事件(至少如果你正确地执行了:) :)



MVC与标准网络技术的关系更为密切,因此将剃须刀视为生成纯HTML页面并控制器处理Web请求的方式。在很多方面,这个我们更好的IMO,但有些人不同意这是Web应用程序的情况,你支付你的钱,你采取你的选择。



为了实现你的目标想要:



使用页面上的标准HTML复选框

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. 包括 JQuery [到你的页面。
  2. 使用Jquery来激活代码。 [ ^ ]。
  3. 在MVC中,可以返回整页以外的内容,并为AJAX调用提供服务。 A上面步骤中的代码应该对服务器进行AJAX调用,这里的一个例子 [ ^ ]
  4. 从服务器获取响应,使用jquery更新UI!

  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!


这篇关于listview / updatepanel in mvc razor 4 asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆