如何使用C#在MVC3中使div可见和不可见 [英] How to make div visible and notvisible in MVC3 using c#

查看:129
本文介绍了如何使用C#在MVC3中使div可见和不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
单击MVC3中的按钮后,如何使div可见/不可见.
谢谢,
Sampath bejugama.

Hi all,
How to make div visible & not visible after clicking button in MVC3.
Thanks,
Sampath bejugama.

推荐答案

您可以创建一个ViewData对象,例如ViewData ["name"] = true
在您看来,您可以检查其值是否为true,例如

You can make an ViewData object like ViewData["name"]=true
and on your view you can check for its value true like

@if((bool)ViewData["name"])
{
//make div
}






or

@if((bool)ViewData["name"] == false)
{
//set style display of div to none
}


这篇关于如何使用C#在MVC3中使div可见和不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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