阅读背景:

MVC客户端从多个视图调用C#实用程序方法

来源:互联网 

I would like to know how to call a POCO class (static) C# utility method from AJAX (or jquery or javascript or whatever) from an MVC view. I want to call this utility method from a number of different views based on client-side user inputs (e.g., clicking the jquery fullcalendar eventClick) without having to integrate the utility with each view's controller. The ultimate goal is to render a colorbox modal dialog, or at least send the JQuery colorbox parameters/syntax back to the view to be executed in the view (client-side). The purpose of the server-side method is to standardize calls to jquery colorbox dialogs. I understand in principle that MVC controllers aren't tied to being used from particular views. So, how would I set up the controller with action methods for common utilities and how would I set up the call to the controller from the view? The view call will pass two string parameters (based on which event the user clicks) to the server-side utility method: key, identifier. The server-side method will do a lookup based on the key and pass back a string value containing the colorbox call that the JQuery function in the view will execute (or it could also be an object containing name/value pairs for the colorbox call parameters).I would like to know how to call a POCO class (




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: