473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C#: Panel Won't (Un)Hide

42
I have a panel that I want to act as an extension of ValidationSummary. Some fields are simply too complex for a RegEx to analyse, so I check them on a button click event and pass error messages to a Label contained in the aforementioned Panel.

Trouble is, the Panel doesn't unhide! A rougher alternative I tried, if (!IsPostBack), doesn't work either.

Expand|Select|Wrap|Line Numbers
  1. <form id="Form1" method="POST" action="" runat="server">
  2.    <div style="width:100%">
  3.       <asp:ValidationSummary ID="ValidationSummary1" CssClass="errorMessage" runat="server" ForeColor="Black" />
  4.    </div>
  5.    <div style="width:100%">
  6.       <asp:Panel ID="customValidationSummary" runat="server" CssClass="errorMessage">
  7.          <asp:Label ID="msg" runat="server" />
  8.       </asp:Panel>
  9.    </div>
Expand|Select|Wrap|Line Numbers
  1. protected void btnSubmit_Click(object sender, EventArgs e)
  2. {
  3.     msg.Text = ValidateFields(); // currently set to do nothing but return an arbitrary nonempty string
  4.  
  5.     if (msg.Text == "")
  6.     {
  7.         // send data on its merry way
  8.     }
  9.     else
  10.     {
  11.         msg.Visible = true;
  12.     }
  13. } // end function
Feb 27 '08 #1
4 2861
spamguy
42
In addition:

The Label inside the Panel doesn't seem to want to change, either. If I leave the Panel visible and tell the text to change to an arbitrary string on button click, it doesn't. Something's fishy, but I don't know what.
Feb 27 '08 #2
Plater
7,872 Expert 4TB
EDIT: Double Oops. Will have to get back to you...

An asp:panel maps back to an html DIV, do you need to nest them like that?
Feb 27 '08 #3
spamguy
42
EDIT: Double Oops. Will have to get back to you...

An asp:panel maps back to an html DIV, do you need to nest them like that?
<div> any thinner than 100% width centres differently from <span>. The only way I've found to centre a <div> is to nest them:

Expand|Select|Wrap|Line Numbers
  1. <div style="width:100%">
  2.      <div style="margin-left:auto;margin-right:auto">Hi there</div>
  3. </div>
  4.  
Feb 27 '08 #4
spamguy
42
I think I figured out the source of the problem.

When there are validation controls in place, the page blocks a button click event when something isn't filled in right and pulls up a validation dialog using Javascript or somesuch. As long as there's a validation violation, there's no postback and no call of Button_Click() -- anything I put in the codebehind to check data myself won't get used.

So now the question becomes: can I circumvent this to have personalised validation and ASP validation controls report at the same time?
Feb 27 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: dje | last post by:
In the OnClick event on a radioButtonList, I run a javascript to show/hide the appropriate div along with a submit button, which displays as expected. The problem is the submit no longer works on...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
4
by: tshad | last post by:
I am trying to hide and show certain parts of my code (which I have no problem doing with DW). In VS 2003, it won't let you use <div runat="server"to section of parts of my code in a table. This...
1
by: vvgopal2k | last post by:
Hi Group, I am facing a problem in ASP.net usercontrols. Here is the Program. When a Click a button on the usercontrol page, a panel shows up on the same user control, this panel has some...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
-- Thanks.
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005, .net 2 and CR 11 Developer for a windows applicaiton. My appl dialogs are hidden when I launch CR Preview dialog. Is CR doing this? Is there a way to un-hide this? Thanks....
1
by: mbruyns | last post by:
i have been trying (and sometimes succeeding) to use the modalpopupextender to show various panels of controls on my asp pages. the strange problem that i keep on running into is that sometimes it...
3
by: andric | last post by:
Originally I need to click on the show button then the table will collapse. But I would like to make it collapse when page onload. Need help on code below !!! function...
3
by: shareme | last post by:
Hi I am using YUI(Yahoo User Interface) Resizable panel as tool Tip.Now I need to close the panel on body click.Panel should not close if any event is performed in it .I try to close the panel by...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.