在用户控制中显示div .................. [英] hid show div in user control..................

查看:73
本文介绍了在用户控制中显示div ..................的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友

我有一个用户控件,我的问题是我使用会话值隐藏显示div如何在用户控件cs页面中检查会话值并隐藏用户控件aspx页面中的div谢谢提前

解决方案

如果您的div在服务器端控制(runat = server),那么您应该处理这个解决方案。

  if (session [  NAME]!=  null 
div.visible = true ;
else
div.visible = false ;





如果你的div在客户端控制,那么你应该处理这个解决方案。



< script type =   text / javascript> 
function OnLoad()
{

var username = ' <%= Session [UserName]%>';
if (用户名!= null
document .getelementByID( div)。style.display = none;
else
document .getelementByID( div)。style.display = ;
}
< / script>


Hi friends
I have one user control and my problem is i have hid show div using session values how to possible check session values in user control cs page and hide div in user control aspx page thanks to advance

解决方案

Hi if your div is at server side control (runat=server) then you should take care of this solution.

if(session["NAME"]!=null)
        div.visible=true;
else
        div.visible=false;



and if your div is at client side control then you should take care of this solutions.

<script type="text/javascript">
    function OnLoad()
    {

        var username = '<%= Session["UserName"] %>';
        if(username != null)
              document.getelementByID("div").style.display="none";
        else
              document.getelementByID("div").style.display="block";
    }
</script> 


这篇关于在用户控制中显示div ..................的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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