如何在asp.net中隐藏html控件 [英] How to hide html control in asp.net
本文介绍了如何在asp.net中隐藏html控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在页面加载中隐藏html控件。我怎样才能做到这一点。我无法访问asp.net中的代码文件中的html控件。我声明了html控件ID并声明了runat = server。
请帮助我..提前谢谢
解决方案
将其添加到html元素:
visible = false;
//我试过这和正常工作
< 输入 类型 = text id = MyInPutText runat = server / >
protected void Page_Load(object sender,EventArgs e)
{
int k = int.Parse(MyInPutText.Value);
//从
后面的代码看它是可见的MyInPutText.Visible = false;
}
假设您正在使用html中的文本框。然后将其声明为
< input tye =textrunat =serverid =txtName/>
现在:
in .cs page
txtName.Visible = false;
I want to hide html control in page load. How can i do that. I can't accesses the html control in code file in asp.net. i declare the html control id and also declare runat=server.
Please help me..Thanks in advance
解决方案
Add this to the html element:
visible="false";
// I have tried this and working Properly <input type="text" id="MyInPutText" runat="server" /> protected void Page_Load(object sender, EventArgs e) { int k = int.Parse(MyInPutText.Value); // Make it Visible from code behind MyInPutText.Visible = false; }
suppose you are taking a textbox in html .Then Declare it as
<input tye="text" runat="server" id="txtName" />
now :
in .cs page
txtName.Visible=false;
这篇关于如何在asp.net中隐藏html控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文