TAILIEUCHUNG - Lập trình .net 4.0 và visual studio 2010 part 46

MVC là rất nhiều thiết lập để tích hợp dễ dàng với các khuôn khổ JavaScript phổ biến như jQuery. Để biết thêm thông tin về jQuery, xin tham khảo Chương 12. | CHAPTER 13 MVC Attributes You have already utilized a number of attributes such as AcceptVerbs and Bind. Attributes extend MVC s functionality and you can even create your own. Let s take a quick look at some important attributes. AcceptVerbs You have already used the AcceptVerbs attribute to distinguish between load and update methods in the Film controller. OutputCache OutputCache is perhaps one of the most useful attributes to reduce load on the server. If your data is changing infrequently consider using OutputCache. The duration is specified in minutes. To use it simply add above your action method OutputCache Duration 20 VaryByParam None public ActionResult News return View Authorization Another important attribute is Authorization. It is used in conjunction with the standaed security providers and allows you to restrict access to a function. The standard template MVC project shows you how to use this. To use it simply add above your method as follows Authorize Roles Admin public ActionResult All return View MVC and JavaScript MVC is very much set up for easy integration with popular JavaScript frameworks such as jQuery. For more information on jQuery please refer to Chapter 12. You will create a new edit page that utilizes the jQuery libraries to send the contents of a form to the edit controller. To do this you will format the data as JSON. JSON stands for JavaScript Object Notation and is a very lightweight format to pass around simple classes and properties. In the film example a film class formatted as JSON might look something like this ID 1 Title Kung Fu Panda 312 CHAPTER 13 MVC JSON is very easy to construct and has the advantage that JavaScript frameworks understand JSON objects allowing you to easily access properties with code like this alert JSON is also a lot less verbose than a typical SOAP request which might look like this xml version encoding utf-8 soap .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.