前台js调用aspx.cs里面的方法????

JavaScript031

前台js调用aspx.cs里面的方法????,第1张

用coolite

Coolite.AjaxMethods.getComodityById(x,{

success: function(result)//result函数的返回结果

{}

})

前台一定要有<ext:ScriptManager ID="sm1" runat="server"></ext:ScriptManager>

后台方法一定要加[AjaxMethod]

导入using Coolite.Ext.Web命名空间,

可以在主页面放个Hide控件 <input type='hide' ruant='server' id='hide1' />

在Frame中给将值传给主页面的Hide

window.parent.document.getByElmentById('hide')

<input type="hidden" id ="nongli" value = ""/>

js里用document.getElementById("nongli").value = "日期"

.cs文件用Request.Form["nongli"]来获取即可.