Jquery-load event not firing asp.net button click event
i Have tow Web page Home.aspx And login.aspx ---
login.aspx SouceCode
<div id="Lbox">
<asp:Label ID="Label1" runat="server" Text="User Id" CssClass="lable"></asp:Label>
<asp:TextBox ID="Txt_userId" runat="server"></asp:TextBox>
<asp:Label ID="Label2" runat="server" Text="Password" CssClass="lable"></asp:Label>
<asp:TextBox ID="Txt_userPass`enter code here`" runat="server"></asp:TextBox>
<asp:Button ID="Bt_login" runat="server" Text="Bt_login"开发者_JS百科 onclick="Bt_login_Click" />
<div>
login.aspx.cs
protected void Bt_login_Click(object sender, EventArgs e)
{
//code here......
}
home.aspx source code
<script type="text/javascript">
$(document).ready(function () {
$("#log").click(function () {
$.blockUI({ message: $($("#Info").load("Login.aspx #Lbox")) });
});
});
</script>
<a id="log">Login</a>
<div id="Info"></div>
problam is here - in login.aspx page Bt_login_Click not firing
That's right, Bt_login_Click
is not supposed to be called. As you loaded part of HTML into <div>
by jQuery load method, you have to handle form submit by yourself then.
$(function() {
$('#Bt_login').live('click', function () {
// you code here
});
});
精彩评论