为什么隐藏分区在asp.net按钮点击后不留? [英] why hidden div is not staying after button click in asp.net?

查看:129
本文介绍了为什么隐藏分区在asp.net按钮点击后不留?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图展现一个登录按钮点击后隐藏的div event..but股利不staying..it是登录后click..but我想留登录按钮点击后的股利,它会消失停留在页面上,直到我点击任何页面..

我的按钮

 < ASP:按钮的ID =loginbutton=服务器文本=登录的OnClientClick =返回someFunction();/>

我的javascript函数

 <脚本类型=文/ JavaScript的>
功能someFunction(){
    $(#logdiv)显示()。
}
< / SCRIPT>


解决方案

下面的DIV是不是你的按钮的点击后留下可见的,因为您在同一时间后回来,重装后页面的DIV再次隐藏起来。

我不建议你担任此职回来,因为可能不是你想要的。您可以尝试无论是与上可见再次渲染格,无论是注册一些其它的脚本后回后使其可见。

i am trying to show a hidden div after a login button click event..but the div is not staying..it is vanishing after the login click..but i want to stay the div after login button click and it will stay in the page untill i click anything in the page..

my button

<asp:Button ID="loginbutton" runat="server" Text="Login"  OnClientClick=" return someFunction();"/>

my javascript function

<script type="text/javascript">
function someFunction() {
    $("#logdiv").show();
}
</script>

解决方案

Here the div is not stay visible after the click of your button because you make at the same time post back, after the reload of the page the div is hidden again.

I am not suggest you to hold the post back because probably is not what you want. You can try either render the div again with visible on, either register some other script after the post back to make it visible.

这篇关于为什么隐藏分区在asp.net按钮点击后不留?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆