如何从代码后面禁用表? [英] How Do I Disable Table From Code Behind?

查看:85
本文介绍了如何从代码后面禁用表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的页面中使用表作为占位符..我给表了一个id,我想从后面的代码中禁用表...表id在codebehand中没有显示为什么?

i am using table as place holder in my page..i gave an id to table and i want to disable the table from code behind...table id does not show in codebehand why?

推荐答案

在表标签中使用runat。然后你就能在Codebehind中找到Id ...



Use runat in table tag.Then you will able to find the Id in Codebehind...
Like
<table  runat="server" id="tbl1">
//your content...
</table>





代码背后:





In Code Behind:

tbl1.Attributes.Add("style", "display: none;");



OR


OR

tbl1.visible=false


问题是表的runat属性。

The problem is runat attribute of a table.
<table id="tbl"runat="server">your design</table>





并在服务器端上面的表格中调用如下;





and call above table in server side like below;

tbl.Visible=false;


这篇关于如何从代码后面禁用表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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