代码隐藏中的div标签 [英] div tag in codebehind

查看:65
本文介绍了代码隐藏中的div标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我想在代码隐藏中使用div标签可见和不可见...但它不会来我必须使用哪个命名空间...

hello friends i want to use div tag visible and invisible in codebehind... but its not coming which namespace i have to use...

推荐答案

尝试这个:)

try this :)
<div id = "testDiv"  runat="server">sample text
            </div>




protected void Button1_Click(object sender, EventArgs e)
{
            testDiv.Visible = false;
}


试试这个,



try this,

<div id="content" runat="server">
    </div>







protected void Page_Load(object sender, EventArgs e)
    {
         if (!IsPostBack)
            {
               content.Visible = false;
            }

    }









如果您的div在GridView或Repeater或任何控件内,那么你可以这样找到它,





Or

If your div is inside GridView or Repeater or any control,Then you can find it like this,

HtmlGenericControl InnerDiv = (HtmlGenericControl)e.Item.FindControl("divName");





我希望这对你有所帮助。



I hope this will help you.


你可以添加具有可见性属性的标签或文本框。

i认为它更简单那样
you can add label or textbox which have a visibility property.
i think it makes simplier that way


这篇关于代码隐藏中的div标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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