?
Solved

Show hidden div

Posted on 2006-11-28
5
Medium Priority
?
297 Views
Last Modified: 2008-03-17
I've placed all my validation summary erros into a hidden div on my ASP.NET pages. How would I go about showing this hidden div when there is an error? I've tried a couple of things but nothing seemed to work...either the div wasn't shown at all or part of the div was shown prior to any error coming up. I'm simply adding the div to the bottom of my main div.

If anyone has a good solution I'd like to see how they did this.
0
Comment
Question by:Steven O'Neill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Assisted Solution

by:REA_ANDREW
REA_ANDREW earned 600 total points
ID: 18027253
what ever event you have that may trigger this hide Show have this surrounding the code

if(Page.IsValid)
{
//Do your Code
}
else{
YourDiv.Visible = true;
return;
}
0
 
LVL 2

Accepted Solution

by:
PaulCampbell earned 800 total points
ID: 18027267
make your div runat server and set it's visability to false:



<div id="validationSummary" runat="server" visibility="False">

 

</div>


then in the code behind, if your page does not validate, simply do:

validationSummary.visible = True


hop it helps
0
 
LVL 19

Assisted Solution

by:DreamMaster
DreamMaster earned 600 total points
ID: 18027307
Why don't you simply use a panel? That creates a DIV as well and is meant for such things. i.e.

<asp:Panel id="pnlErrors" runat="server" visible="false">
Errors go here
</asp:Panel>

And in the code behind:

If (Page.IsValid = False) Then
    pnlErrors.Visible = True
Else
    pnlErrors.Visible = False
    'Handle the form
End If

Regards,
Max.  
0
 
LVL 2

Author Comment

by:Steven O'Neill
ID: 18080554
I've actually done this another way but it does involve the use of divs but I merely set the validator to Dynamic and have each validator held in a span which has a class applied to it effectively hidding it meantime.

Thanx anyway guys and I've split the points accordingly

BTW I already use asp:Panel within my code and find them very effective...great improvement over classic ASP.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18083265
Glad to have been helpful :)

Regards,
Max.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question