Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 11th, 2005, 12:15 PM   #1
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 372
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Question Problem with showing error

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="proj1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
    <title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>
  </HEAD>
<body MS_POSITIONING="GridLayout">
<h3>
		<font face="Verdana">Bug Report</font> </H3>
	
	<form id="frmBugs" method="post" runat="server">
		<table bgcolor=gainsboro cellpadding=10>
		<tr valign=top>
			<td colspan=3>
				<!-- Display error message -->
					<asp:Label ID="lblMsg"
				Text = "Please report your bug here"
				ForeColor="red" Font-Name="Verdana"
				Font-Size="10" Runat=server></asp:Label>
			<br >
			</td>
		</tr>	
			<tr>
				<td align=right>
					<font face=Verdana size=2>Book</font>
				</td>		
			<td>
				
			<!-- Drop down list with books -->
			
				<asp:DropDownList ID=ddlBooks Runat=server>
					<asp:ListItem>-- Please Pick A Book --</asp:ListItem>
					<asp:ListItem>
						Teach Yourself c++ in 21 Days
					</asp:ListItem>
					<asp:ListItem>
						Teach Yourself c++ in 24 hours
					</asp:ListItem>
					<asp:ListItem>TY C++ int 10 min</asp:ListItem>					
				</asp:DropDownList>
			</td>
			
			<!-- validator for the drop down -->
			
			<td align=center rowspan=1>
				<asp:RequiredFieldValidator
				id="reqFieldBooks"
				ControlToValidate="ddlBooks"
				Display="Static"
				InitialValue="--Please Pick A Book--"			
				Width="100%" Runat=server>
					Please choose a book
				</asp:RequiredFieldValidator>
			
			</td>
			
			</tr>
			<tr>
				<td align=right>
					<!-- Radio Buttons For The Edition -->
					<font face=Verdana size=2>Edition:</font>
				</td>
				<td>
					<asp:RadioButtonList ID=rblEdition
					RepeatLayout="Flow" Runat=server>
						<asp:ListItem>1st</asp:ListItem>
						<asp:ListItem>2nd</asp:ListItem>
						<asp:ListItem>3rd</asp:ListItem>
						<asp:ListItem>4th</asp:ListItem>
					</asp:RadioButtonList>
				</td>
				<!-- Validator for editions -->
				<td align=center rowspan=1>
					<asp:RequiredFieldValidator
					id="reqFieldEdition"
					ControlToValidate="rblEdition"
					Display=Static
					InitialValue=""
					Width="100%" Runat=server>
						Please pick an edition
					</asp:RequiredFieldValidator>
					
				</td>				
			</tr>
			<tr>
				<td align=right style="HEIGHT: 97px">
					<font face=Verdana size=2>Bug:</font>					
				</td>
				<!-- Multi line text for bug entry -->
				<td style="HEIGHT : 97px">
					<asp:TextBox ID=txtBug Runat=server Width=183px TextMode=MultiLine Height=68px>						
					</asp:TextBox>
				</td>				
				<!-- Validator for texbox -->
				<td style="HEIGHT : 97px">
					<asp:RequiredFieldValidator
					id="reqFieldBug"
					ControlToValidate="txtBug"
					Display="Static"
					Width="100%" Runat="server">
						Please provide bug details
					</asp:RequiredFieldValidator>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<asp:Button ID=btnSubmit Text="SubmitBug" Runat=server></asp:Button>
				</td>
				<td></td>
			</tr>
		</table>
		
    </form>
	
  </body>
</HTML>

Ok, i put here all of the code , so maybe someone will try it out. The problem is that when i don't select anything from the book list, it doesn't show the error message. But works fine for the others.

Oh, and the button submit has this code_behind attached to it :
protected void btnSubmit_Click(object sender, System.EventArgs e)
		{
			if (Page.IsValid)
			{
				lblMsg.Text = "Page is Valid!";
			}
			else 
			{
				lblMsg.Text = "Some of the required fields are empty";
			}
		}

The weird thing is that in Firefox if not all of the fields are valid it says: "Some of the required fields are empty". In IE it doesn't(why?). But they both show "Page is Valid! " if all the fields are correct .

So, any ideea about y that error message isn't showing ? for the book list?
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Oct 12th, 2005, 1:55 AM   #2
maro25
Newbie
 
Join Date: Oct 2005
Posts: 6
Rep Power: 0 maro25 is on a distinguished road
I would guess that in one you are writing: "--Please Pick A Book--"
and in the other -- Please Pick A Book --

notice in the second the spaces between -- and the text
__________________
Password Spyer 2k: Password Recovery Software
My NEW SEO forum
maro25 is offline   Reply With Quote
Old Oct 12th, 2005, 2:34 AM   #3
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 372
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
Damn, that was it. Thanks . But now there still is something weird :
In IE , if i choose the first book from the list, it's all fine when i press submit. But in Firefox, it only works if i pick the last book :eek:

Also, there still is the thing when i press the button and if there are any more fields left unfilled , it should say : "Some of the required fields are empty" .. in firefox it works , in IE it doesn't :mad:
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Oct 13th, 2005, 9:52 PM   #4
MrMan9879
Programmer
 
MrMan9879's Avatar
 
Join Date: Sep 2005
Location: Nanaimo, BC, Canada
Posts: 95
Rep Power: 0 MrMan9879 is an unknown quantity at this point
Send a message via MSN to MrMan9879
Maybe you have another error that we can't find. Since IE is Microsoft, it tends to display microsoft made things a lot better than Netscape and FireFox etc. (For example: FrontPage built websites).
MrMan9879 is offline   Reply With Quote
Old Oct 15th, 2005, 3:39 AM   #5
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 372
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
No errors that i can find, just weird that one thing is displayed just in firefox an another just in IE .. oh well , that's it.
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC