开发工具:
文件大小: 53kb
下载次数: 0
上传时间: 2009-07-14
详细说明:
AJAX .Net Wrapper quick usage guide Karl Seguin - http://www.openmymind.net/ - copyright 2005 (view AjaxGuide.doc for more detailed information) Step 1 - Create a reference to the ajax.dll file Step 2 - Set up the HttpHandler In the web.config, set up th e HttpHandler, like: ... Step 3 - In the Page_Load event, call the following function: 'vb.net Public Class Index Inherits System.Web.UI.Page Private Sub Page_Load(sender As Object, e As EventArgs) Handles MyBase.Load Ajax.Utility.RegisterTypeForAjax(GetType(Index)) '... end sub '... End Class //C# public class Index : System.Web.UI.Page{ private void Page_Load(object sender, EventArgs e){ Ajax.Utility.RegisterTypeForAjax(typeof(Index)); //... } //... } Step 4 - In the codebehind of your page, add functions (like you normally would) that you'd like to be able to asynchrounsly called by client-side scripting. Mark these functions with the Ajax.JavascriptMethodAttribute(): //C# [Ajax.AjaxMethod()] public int ServerSideAdd(int firstNumber, int secondNumber) { return firstNumber + secondNumber; } 'VB.Net _ Public Function ServerSideAdd(ByVal firstNumber As Integer, ByVal secondNumber As Integer) As Integer Return firstNumber + secondNumber End Function The wrapper will automatically create a JavaScript function named "ServerSideAdd" which accepts to parameters. When called, this server-side function will be called and the result returned. Step 5 - Using JavaScript, you can invote the ServerSideAdd function like you would any other JavaScript function. You can call it using the two parameters, or optionally pass a call back function. The name of the function is, by default, ., such as Index.ServerSideAdd: alertIndex.ServerSideAdd(100,99)); OR Index.ServerSideAdd(100,99, ServerSideAdd_CallBack); function ServerSideAdd_CallBack(response){ alert(response.value); } The response exposes three properties, error, value and request. Note that you can return more complex objects that simple types. See the demo for additional information: http://ajax.schwarz-interactive.de/csharpsample/default.aspx ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.