ajax无刷新的动作无效? 两个asp:DropDownList做联动,用的.net的ajax,asp:ScriptManager和asp:UpdatePanel都加了,咋滴不能触发后台的方法呢?页面还要加啥东西?web.config里已经根据framework2加过东西了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、断点看看有没进方法2、使用浏览器调试工具比如:火狐的FireBug看看有没有向地址发送请求。 asp:UpdatePanel把你的asp:DropDownList 控件 一起放入其中!就可以了!一定要有规则型的,不然就会失效! 火狐的FireBug?太高深遨游可以调试么?规则性是什么意思?我的两个下拉是放在两个td里的,这样有影响么? <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <!--方法1 这样也行 --> <div> <table> <tr> <td> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"> </asp:DropDownList> <asp:DropDownList ID="DropDownList2" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> </td> </tr> </table> <!--方法2 这样也行 --> <table> <tr> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <td> <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true"> </asp:DropDownList> <asp:DropDownList ID="DropDownList4" runat="server"> </asp:DropDownList> </td> </ContentTemplate> </asp:UpdatePanel> </tr> </table> </div> 没搞过.net ajax控件,一直用jq ajax一直用jquery 简单实在 比如:1、简单的post请求$.post("Default.aspx?action=Login", { 'id':1 }, function (data) { //dosomething});//参数1:发送的地址,参数2:发送的参数 因为是post方式 所以格式为json格式 后台取 用request.form//function(data){} 成功后执行的方法 data为成功后的返回值2、简单的get请求$.get('Default.aspx?action=Login&id=1, function (data) { //dosomething});//因为是get方式 参数采用的是地址栏参数的形式如:id=1 其余的如同post3、WebService方式$.ajax({ type: "POST", //类型:post get async: false, //是否异步 url: "Live_RecordTask_Hand.aspx/SaveTask", //URL地址即后台方法地址 data: "{'ID':'1'}", //参数 dataType: "text", //返回类型 contentType: "application/json; charset=utf-8", success: function (msg) { //成功执行.. //dosomething }, error: function (xhr, msg, e) { alert(msg);//出错处理 } }); 建议使用jquery,.net自带异步处理操作客户体验较差.. 不好意思,项目一直被打断,等我空了来试试jquery到底有多爽哈 updatepanel 还有一个属性用于监测哪个控件 引发刷新操作 我忘记它的词怎么写了,你查一下吧 dropdownlist的autopostback="true"加了吗? jquery确实使用方便,感谢楼上的达达们,就剩这点分数了,散了吧.... VS2005打开项目文件出现问题。。高手进。。在线等。。 怎么去掉frame里面的滚动条,让其自动适应大小! 重装IIS后ASP.NET没有了 可否将asp项目转换成asp.net项目 服务器不支持TreeView SOS! 动态加载用户控件的问题 为什么我绑定datagrid中的按键项点击后没有反应? MSSQL中用户登录失败, 求C#邮件接收类,及调用例子,给高分呀,在线等待 如何得到DataReader的字段的名字 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 112.65.195.146:25 asp.net 生成图片后如何保存的问题?
2、使用浏览器调试工具比如:火狐的FireBug看看有没有向地址发送请求。
火狐的FireBug?太高深
遨游可以调试么?
规则性是什么意思?我的两个下拉是放在两个td里的,这样有影响么?
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<!--方法1 这样也行 -->
<div>
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<!--方法2 这样也行 -->
<table>
<tr>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<td>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList4" runat="server">
</asp:DropDownList>
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
</table>
</div>
比如:1、简单的post请求
$.post("Default.aspx?action=Login", { 'id':1 }, function (data) {
//dosomething
});
//参数1:发送的地址,参数2:发送的参数 因为是post方式 所以格式为json格式 后台取 用request.form
//function(data){} 成功后执行的方法 data为成功后的返回值
2、简单的get请求
$.get('Default.aspx?action=Login&id=1, function (data) {
//dosomething
});
//因为是get方式 参数采用的是地址栏参数的形式如:id=1 其余的如同post
3、WebService方式
$.ajax({
type: "POST", //类型:post get
async: false, //是否异步
url: "Live_RecordTask_Hand.aspx/SaveTask", //URL地址即后台方法地址
data: "{'ID':'1'}", //参数
dataType: "text", //返回类型
contentType: "application/json; charset=utf-8",
success: function (msg) {
//成功执行..
//dosomething
},
error: function (xhr, msg, e) { alert(msg);//出错处理 }
});