Asp.net下用JQuery找出哪一个元素引起PostBack
2018-10-12 13:56
369 查看
先看ASPX:
然后在Sever端这么写:
很简单的CODE.
希望这篇POST对您有帮助。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Petter Liu demo</title>
<script src="http://img.jb51.net/jslib/jquery/jquery14.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("input:submit").click(function() {
$("#HiddenField1").val($(this).attr("id")
+ " 引起一个 postback");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" />
<asp:Button ID="Button3" runat="server" Text="Button3" />
<asp:HiddenField ID="HiddenField1" runat="server" />
</div>
</form>
</body>
</html>
然后在Sever端这么写:
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
/// <remarks>Author Petter Liu http://wintersun.cnblogs.com </remarks>
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(HiddenField1.Value);
}
很简单的CODE.
希望这篇POST对您有帮助。
您可能感兴趣的文章:
相关文章推荐
- Asp.net用JQuery找出哪一个元素引起PostBack
- Asp.net下用JQuery找出哪一个元素引起PostBack
- Asp.net JQuery UI Dialog Postback
- 【Asp.net入门3-03】jQuery-选择元素
- Asp.Net Textbox with jQuery UI Datepicker value lost on a postback
- Page_Load与sender -- PostBack是由哪个 ASP.NET控件引起 ?
- Jquery 组合form元素为json格式,asp.net反序列化
- Jquery 组合form元素为json格式,asp.net反序列化
- 缓存引起的session问题(ajax,js,jquery,asp.net,C#)
- Jquery 组合form元素为json格式,asp.net反序列化
- jQuery UI confirmation dialog and asp.net postback
- asp.net-元素定位、显示设置、jQuery监听事件和显示效果
- ASP.NET GetPostBackEventReference
- jquery判断asp.net<asp:Repeater>里面的checkbox是否选中
- JQuery上传插件Uploadify使用详解 asp.net版
- 使用ASP.NET AJAX 和JQuery一起解决翻页选择的问题
- jQuery 1.3 for Asp.Net、 CSLA.Net 3.6 for Windows 及 MOSS/WSS 一步一步从入门到精通三个系列的目录
- ASP.NET jQuery 实例2 (表单中使用回车在TextBox之间向下移动)
- asp.net中几种页面元素的比较
- 关于 ASP.net + JQuery + JQGrid + JSON.net 的简单应用(三)