Click here to Skip to main content
11,410,750 members (63,177 online)
Rate this: bad
good
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
Comments
Raje_ at 25-Feb-13 4:14am
   
add runat="server" in your div tag.

1 solution

Rate this: bad
good
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
</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
}
  Permalink  
v4
Comments
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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,885
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | 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