Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I want to check div is visible or not in code behind method.If div will be visible, i have to insert data otherwise i don't have to insert any data.
Posted
Comments
hypermellow 20-Mar-15 10:26am    
Hi, an asp:Panel control might be a better choice for this scenario.
As it will be available in code behind, and will also render a div element to the client browser.

1 solution

Make sure you're div has an id and a runat="server" on it and then you can access it in codebehind.

XML
<div id="div1" runat="server"> 
... 
</div>


C#
if (div1.Visible)
{
 // do whatever
}
 
Share this answer
 
Comments
itsathere 20-Mar-15 10:31am    
not working..
itsathere 20-Mar-15 10:38am    
i am using style="display: none" to hide div and then i want to check that's all.
ZurdoDev 20-Mar-15 10:50am    
In that case you can check div1.Style["display"]
itsathere 20-Mar-15 11:07am    
I also checked that not working..
ZurdoDev 20-Mar-15 11:08am    
You have to explain what "not working" means.

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