Click here to Skip to main content
12,895,064 members (50,978 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Javascript C#4.0
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 24-Feb-13 22:07pm
Raje_ 25-Feb-13 4:14am
add runat="server" in your div tag.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
<div id="myDivTag"  runat="server" class="someCSS">
     my div

Then you can access the tag from your code behind to test it's visibility like so:
if (myDivTag.Style["Display"] != "none")
     // DIV is visible, so do some stuff
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)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100