Click here to Skip to main content
11,483,003 members (75,202 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: 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 23:07pm
Raje_ at 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 at 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)

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2015
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