Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 10-May-17 5:03am
Comments
Mahendra.p25 9-May-11 5:53am    
which html control you are using

Add this to the html element:

C#
visible="false";
 
Share this answer
 
v2
XML
// 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;
        }
 
Share this answer
 
v2
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;
 
Share this answer
 
when you debug the code put a debugger and see you will be able to see the html control and then add this code
C#
ControleId.Style.Add("display", "none");
 
Share this answer
 
v2
Make Visiblie="false" in HTML Element

<input type="Text" id="txtName" runat="Server" visible="false" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900