Click here to Skip to main content
16,019,619 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to disable a div on page load on an asp.net webform
Posted
Comments
Thanks7872 30-Apr-14 4:52am    
I can see most of the questions you posted can easily be resolved using simple google search. Try something before posting something.
bluesathish 30-Apr-14 5:49am    
This is not a solution he is looking for, its better to keep away(omit question) instead of posting a comment like this.
Thanks7872 30-Apr-14 6:08am    
Why to omit if i can suggest something to improve the site and his effort as well? It is as simple as hide div asp.net code behind.
Further, this is comment section and i didnt mention anything about the solution.
bluesathish 30-Apr-14 6:20am    
Thumbs Up :-)

Set your div's runat="server" property and give its id as a valid name like below

ASP.NET
<div id="div1"  runat="server"></div>


And in your code behind file,

C#
Page_Load()
{
  divl1.Disabled = true;
}
 
Share this answer
 
v2
HTML
<div id="div1" class="<%=displayclass%>"></div>

add style class 
    .dclass
      {
         display:none;
      }


code
----
public string displayclass ;

page load
-----

displayclass ="dclass";         // display none

if you want to display in any other place set displayclass="";
 
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