Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have connected a div tag in javascript to show validation error messages.If there is an error the error msg will appear. If the user clicks the button the user should not be allowed to move to next page so i am checking the visibility of div in codebehind. How to do that.
Posted
Comments
Raje_ 25-Feb-13 4:14am    
add runat="server" in your div tag.

1 solution

As Raje has pointed out, you can access a DIV tag from your code behind by adding the runat="server attribute to the DIV tag on your page:
ASP.NET
<div id="myDivTag"  runat="server" class="someCSS">
     my div
</div>

Then you can access the tag from your code behind to test it's visibility like so:
C#
if (myDivTag.Style["Display"] != "none")
{
     // DIV is visible, so do some stuff
}
 
Share this answer
 
v4
Comments
vasanth90 26-Feb-13 4:03am    
thanks fro reply....ya i have given runat = "server" already. but still i couldn't get.

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