473,806 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#: Panel Won't (Un)Hide

42 New Member
I have a panel that I want to act as an extension of ValidationSumma ry. 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 2885
spamguy
42 New Member
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 Recognized Expert Expert
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 New Member
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 New Member
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
3207
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 the button. If I quit using the divs, and do a postback on the radiobutton selection, showing/hiding tables instead, the button is ok and continues to work. I've tried a variety of controls instead of the button in a variety of places but it...
9
3188
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... So the behavour is similar to a tab control. The user is expected to fill out required data on each of the panels before pressing a submit button which is visible from all panels. Problem I have is validating the data entered by the user. I...
4
6887
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 is during compilation (build). My code is: <TABLE id="Table1" style="WIDTH: 864px; HEIGHT: 177px" cellSpacing="1" cellPadding="1" width="864" border="0">
1
1774
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 textboxes and combo boxes and button say btnSave(all are ASP:controls..). And in the codebehind I have added btnSave.attributes.add("OnClick", "return validateForm(.........) in this function I am passing the clientID of textboxes,comboboxes(contents...
0
855
by: =?Utf-8?B?UHVjY2E=?= | last post by:
-- Thanks.
0
870
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. Thanks.
1
4855
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 works, displaying an awesome popup, while other times, it doesn't show a popup at all, but rather just page posts back and the panel becomes visible at the bottom of the page (where it is situated in the designer). what is even stranger to me is that...
3
1786
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 KZAdhocBarToggleVisibility(sBarId) { if ( typeof(Page_KzAdhocBars)== 'undefined') { return; } var bar = null; for( var iI = 0 ; iI < Page_KzAdhocBars.length ; iI++)
3
1965
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 "<body onclick()>" .I thought trough that i can get the id of the element to close the panel but if i click on the panel i am getting both the id of panel (div id) followed by body id .How can i do this .Right now i am closing the panel with the...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.