HTML元素的ASP按钮点击后隐藏 [英] html elements hiding after asp button click
问题描述
我有一些HTML控件默认其显示值是无。我有锚这是展示这种形式。
I have some html controls which default display value is none. I have anchor which is showing this form.
形式:
<div id="login_container">
<div id="login_close">
<img src="images/close.png" align="close" title="close" />
</div>
<h2>
Login</h2>
<h5 id="incorrect_login" runat="server">
Username or Password is incorrect</h5>
<span>
<p>
Username:</p>
<asp:TextBox ID="txtUserName" runat="server" CssClass="textbox" />
</span>
<br />
<span>
<p>
Password:</p>
<asp:TextBox ID="txtPasswrod" runat="server" CssClass="textbox" TextMode="Password" />
</span><span>Remember Me
<input type="checkbox" id="chkbRememberMe" class="checkox" runat="server" />
</span>
<input type="button" class="default_button" id="btnLogin" value="Login" runat="server"
onserverclick="btnLogin_Click" />
<br />
<div id="forgot">
<a href="#">Forgot you username?</a>
<br />
<a href="#">Forgot you password?</a>
</div>
</div>
</div>
jQuery的:
jquery:
var AnimateLoginShow = function () {
$('#login_form').css('display', 'none');
$('#back_drop, #login_container').animate({ 'opacity': '0.3' }, 200, 'linear');
$('#login_container').animate({ 'opacity': '1.00' }, 0, 'linear');
$('#login_container').animate({ 'width': '430' }, 150, 'linear');
$('#login_container').animate({ 'height': '280' }, 150, 'linear');
$('#login_form').css('display', 'block');
$('#login_form').animate({ 'opacity': '1.00' }, 300, 'linear');
$('#back_drop, #login_container').css('display', 'block');
}
$('#login').click(function () {
AnimateLoginShow();
});
所以我的问题是,当用户点击登录按钮(此表格),其中有后面这种形式code是返回到原来的状态(显示:无)
So my problem is that when user clicks login button (on this form) which have code behind this form is Returns to its original state (display:none)
P.S这种形式是AJAX更新面板内
p.s this form is inside ajax update panel
推荐答案
看起来你需要通过调用添加脚本<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx\"相对=nofollow> ScriptManager.RegisterStartupScript 方法来显示页面上的元素:
It looks like you need to add script by calling ScriptManager.RegisterStartupScript method to show elements on page:
ScriptManager.RegisterStartupScript(this, this.GetType(), this.ID, "$('#back_drop, #login_container').css('display', 'block');", true);
这篇关于HTML元素的ASP按钮点击后隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!