473,382 Members | 1,258 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,382 software developers and data experts.

Validaion Control

Using Framework 1.1 and Asp.Net

Does the Asp control Validation Summary work in 1.1?
Jun 19 '07 #1
2 1244
"dancer" <da****@microsoft.comwrote in message
news:e3**************@TK2MSFTNGP05.phx.gbl...
Using Framework 1.1 and Asp.Net

Does the Asp control Validation Summary work in 1.1?
Yes:
http://msdn2.microsoft.com/en-us/lib...6h(vs.71).aspx
--
http://www.markrae.net

Jun 19 '07 #2
Then what am I missing in this code?
It gives me the text, but not the fields that are missing.
-------------------------------------------
<%@ Page Language="VB" Debug = "true" %>

<%@ Import Namespace="System.Web.Mail" %>

<script language="VB" runat="server">

Sub btnSendMail_OnClick(Source As Object, E As EventArgs)
Dim TheLocation As String = Location.Text

Dim TheDate As String = DateofAccident.Text

Dim TheWho As String = Who.Text

Dim Empornon As String

Dim TheCheckemp As String = checkemp.Text

Dim TheChecknon As String = Checknon.Text

Dim TheCheckpremisesyes As String = checkpremisesyes.Text

Dim TheCheckpremisesno As String = Checkpremisesno.Text

Dim Premises As String

Dim TheCheckJobsiteYes As String = checkjobsiteyes.text

Dim ThecheckJobsiteNo As String = checkjobsiteno.text

Dim Jobsite As String

Dim TheTimeAM As String = am.Text

Dim TheTimePM As String = pm.Text

Dim TheTime As String

Dim TheHireDate As String = Hiredate.Text

Dim TheJobTitle As String = occupation.Text

Dim Tenure As String = lengthofjob.Text

Dim TheOperation As String = operation.Text

Dim TheOperationNew As String

Dim TheHow As String = how.text

Dim TheHowNew As String

Dim TheNature As String = nature.Text

Dim TheNatureNew As String

Dim TheIndicate As String

Dim TheAction As String = action.Text

Dim TheActionNew As String

Dim Training As String = EmpTrain.SelectedItem.Text

Dim TheCaution as string=EmpCaution.SelectedItem.Text

Dim TheReport as String = EmpReport.SelectedItem.Text

Dim TheModifiedDuty As String = ModifiedDuty.SelectedItem.Text

Dim TheSubmitter As String = Submitter.Text

Dim TheToday As String = Today.Text

Dim myMessage As New MailMessage

Dim myMail As SmtpMail

Dim strEmail As String

Dim UserMessage As String

Dim TheGetOther As String = GetOther.Text


If Checkemp.Checked AndAlso Checknon.checked Then

Empornon = "Both"

ElseIf Checkemp.Checked Then

Response.Write(Checkemp.Checked)

Empornon = "Employee"

ElseIf Checknon.checked Then

Response.write(Checknon.Checked)

empornon= "Non-Employee"

Else Empornon = ""

End If
If Empornon = "" Then

Response.Write("<font color=""red"">ERROR: Choose Employee or
Non-Employee</font>")

Exit Sub

End If

If Checkpremisesyes.Checked Then

Premises = "Yes"

ElseIf Checkpremisesno.Checked Then

Premises = "No"

Else Premises = ""

End If

If CheckJobSiteYes.Checked Then

Jobsite = "Yes"

ElseIf CheckJobsiteNo.checked Then

Jobsite = "No"

Else Jobsite = ""

End If

If TheTimeAm <"" Then

TheTime = TheTimeAm & " AM"

ElseIf TheTimePM <"" Then

TheTime = TheTimePM & " PM"

Else TheTime = ""

End If

TheActionNew = TheAction.Replace(vbCrLf,"<br />")

TheNatureNew = TheNature.Replace(vbCrLf,"<br />")

TheHowNew = TheHow.Replace(vbCrLf,"<br />")

TheOperationNew = TheOperation.Replace(vbCrLf,"<br />")
Dim s As String

Dim i As Int32

For i = 0 to Indicate.Items.Count-1

If Indicate.Items(i).Selected Then

s= s & Indicate.Items(i).Text & "<br>"

End If
Next
If Page.IsValid() Then

'strEmail = txtEmail.Text

'Location = Location.Text

myMessage.From = "xx*@xxxxxxx.com"

MyMessage.To = "xxxx*@xxxxxxx.com"

myMessage.Subject = "Accident Form (HTML)"

' This is the magic line. Without this the message will just appear

' as plain HTML and won't be rendered by the recipient's email client.

' It'd be as if they did "View Source" on a web page.

MyMessage.BodyFormat = MailFormat.Html

myMessage.Body = "<h2>Wheeler's Accident Investigation Form</h2>" & vbCrLf _

& " <p>" & vbCrLf _

& "<html><body<table width = ""750"" bgcolor=""#E9EDF4"" height=""25""
border=""1"" cellpadding=""3"" fontface=""Verdana"" Size=""2"">" & vbCrLf _

& "<tdLocation where accident occurred: " & "<br>" & Thelocation & "<br>"
& "</td>" & vbCrLf _

& "<tdEmployer's Premises? " & premises & "<br>" & vbCrLf _

& " Job Site? " & Jobsite & "<br>" & "</td>" & vbCrLf _

& "<tdDate of accident: " & TheDate & "<br>" & "</td>" & vbCrLf _

& "<tr><tdWho was injured: " & Thewho & "<br>" & "</td>" & vbCrLf _

& "<tdEmployee or non-employee?" & "<br>" & empornon & "<br>" & "</td>" &
vbCrLf _

& "<tdTime of accident: " & TheTime & "<br>" & "</td>" & "</tr>" & vbCrLf
_

& "<tdDate of Hire: " & TheHireDate & "<br>" & "</td>" & vbCrLf _

& "<tdJob Title: " & TheJobTitle & "<br>" & "</td>" & vbCrLf _

& "<tdHow long has employee worked at job where injury occurred? " &
Tenure & "<br>" & "</td>" & "</tr>" & vbCrLf _

& "<tr<td colspan=""3""What was employee doing when injury occurred? " &
TheOperation & "<br>" & "</td></tr>" & vbCrLf _

& "<tr<td colspan=""3""How did the injury occur? " & TheHowNew & "<br>"
& "</td></tr>" & vbCrLf _

& "<tr<td colspan=""3""Nature and extent injury and property damaged: "
& TheNatureNew & "<br>" & "</td></tr>" & vbCrLf _

& "<tr<td colspan=""3""PLEASE INDICATE ALL WHICH CONTRIBUTED TO THE
INJURY: " & "<BR>" & S & "</TD></TR>" & vbCrLf _

& "<tr<td colspan=""3""Supervisor's corrective action to ensure this
type of accident does not recur: " & TheActionNew & "<br>" & vbCrLf _

& "<tr<td colspan=""3""Was employee trained in the appropriate use of
Personal Protective Equipment/Proper safety procedures? " & Training &
vbCrLf _

& "<br>" & "</td></tr>" & vbCrLf _

& "<tr><td colspan=""3""Was employee cautioned for failure to use Personal
Protective Equipment/Proper safety procedures? " & TheCaution &"</tr></td>"
& vbCrLf _

& "<tr<tdDid employee promptly report the injury? " & TheReport &
"</td>" & vbCrLf _

& "<tdIs there modified duty available? " & TheModifiedduty & "</td></tr>"
& vbCrLf _

& "<tr<tdPerson submitting this form: " & "<br>" & theSubmitter &
"</td>" & vbCrLf _

& "<tdDate: " & Thetoday & vbCrLf _

& "</td><tr></table</body>"

' Doesn't have to be local... just enter your

' SMTP server's name or ip address!

' myMail.SmtpServer = "smtp.xxxxxxxx.com"

myMail.SmtpServer = ""

myMail.Send(myMessage)

frmEmail.Visible = False

UserMessage = "Has Been Sent."

'lblUserMessage.Text = "Place of accident " & Thelocation

End If

End Sub

</script>

<html>

<head>

<title>ASP.NET Email (HTML Format) Sample</title>

</head>

<body>
<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">

<h3><center><font face="Verdana">Wheeler's Accident Investigation
Form</font></center></h3>

<form method="post" id="frmEmail" runat="server">


<%--__________________________________________________ __________________________--%>

<%--ROW 1--%>
<td width="245" valign="top">

<font face="Verdana" Size="2">

Location where accident occurred: <asp:textbox id="Location" runat=server
columns="25"/>

<asp:RequiredFieldValidator id="RequiredFiedlValidator1" runat="server"
Text="The location field is required."

ControlToValidate="Location"></asp:RequiredFieldValidator>

</td>

<td align="right" valign="top" width="225">
<font face="Verdana" Size="2">Employer's Premises

<asp:CheckBox id=Checkpremisesyes Text="yes" runat="server" />

<asp:CheckBox id=Checkpremisesno Text="no" runat="server" />

<br>
Job site

<asp:CheckBox id=Checkjobsiteyes Text="yes" runat="server" />

<asp:CheckBox id=Checkjobsiteno Text="no" runat="server" />
</td>

<td>

<font face="Verdana" Size="2">Date of accident</font><br>

<asp:textbox id="DateofAccident" runat=server Width="100"/></asp:textbox>

<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"

Text="The Date field is required" ControlToValidate="Dateofaccident">

</asp:RequiredFieldValidator>

</td>

<%--__________________________________________________ __________________________--%>

<%--ROW 2--%>
<tr<td>

<font face="Verdana" Size="2">Who was injured?</font><br>

<asp:textbox id="Who" runat=server columns="25"/>

<asp:RequiredFieldValidator id="RequiredFiedlValidator3" runat="server"
Text="You must answer who was injured."

ControlToValidate="Who"></asp:RequiredFieldValidator>

</td>

<td align= "left">

<font face="Verdana" Size="2">Employee <asp:CheckBox id=Checkemp
runat="server" />

<br>

Non-employee <asp:CheckBox id="Checknon" runat="server" />
</td>

<td align="right"><font face="Verdana" Size="2">

Time of accident a.m. <asp:textbox columns="6" id="am" runat=server />

<brp.m. <asp:textbox id="pm" runat=server columns="6"/>

</TD>

<%--__________________________________________________ __________________________--%>

<%--ROW 3--%>

<tr>

<td>

<font face="Verdana" Size="2">Date of Hire <br<asp:textbox id="Hiredate"
runat=server/>

</td>

<td>

<font face="Verdana" Size="2">Job Title or Occupation <br><asp:textbox
id="occupation" runat=server columns="25"/>

</td>

<td<font face="Verdana" Size="2">How long has employee worked at job where
injury occurred?<br><asp:textbox id="lengthofjob" runat=server/>

</td>

</Table>

<%--__________________________________________________ __________________________--%>

<%--Row 4--%>

<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">

<tr>

<td>

<p>

<font face="Verdana" Size="2">What was employee doing when injury occurred?

What machine or tool was being used? What type of operation?<br>

<asp:textbox TextMode= "Multiline" Rows= "5" columns= "80"

id="operation" runat=server width="730" height="40"/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorDoing" runat="server"

Text="You must answer this question" ControlToValidate="operation">

</asp:RequiredFieldValidator>

</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 5--%>

<td<font face="Verdana" Size="2">How did injury occur? List all objects
and substances involved.<br>

<asp:textbox TextMode="MultiLine" Rows="5" columns= "80" id="How"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorObjects"
runat="server"

Text="You must answer this question" ControlToValidate="How">

</asp:RequiredFieldValidator>

</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 6--%>

<tr>

<td><font face="Verdana" Size="2"Nature and extent of injury and property
damaged (be specific)

<asp:textbox TextMode="MultiLine" Rows="2" columns= "80" id="nature"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorNature" runat="server"

Text="You must answer this question" ControlToValidate="nature">

</asp:RequiredFieldValidator>

</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 7--%>

<tr>

<td><font face="Verdana" Size="2" type = "strong"PLEASE INDICATE ALL OF
THE FOLLOWING WHICH CONTRIBUTED TO THE INJURY:

<asp:CheckBoxList id=Indicate runat="server">

<asp:ListItem style<font face="Verdana" Size="2">Improper
instruction</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Lack of training or
skill</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Operating without
authority</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Horseplay</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Physical or mental
impairment</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Failure to
secure</asp:ListItem>

<asp:ListItem style<font face="Verdana" Size="2">Failure to
lockout</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Unsafe position</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Improper dress</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Improper protective
equipment</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Unsafe equipment</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Poor
housekeeping</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Unsafe arrangement or
process</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Poor ventilation</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Improper
guarding</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Improper
maintenance</asp:ListItem>

<asp:ListItem<font face="Verdana" Size="2">Inoperative safety
device</asp:ListItem>
</asp:CheckBoxListOther <asp:TextBox columns = "50" id="GetOther"
runat=server/>

</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 8--%>

<tr>

<td colspan= "3"><font face="Verdana" Size="2"Supervisor's corrective
action to ensure this type of accident does not recur:

<asp:TextBox TextMode="MultiLine" Rows="5" columns= "80" id=action
runat="server"/>

<br>

<asp:RequiredFieldValidator id="RequiredFieldValidatorAction" runat="server"

Text="You must answer this question" ControlToValidate="action">

</asp:RequiredFieldValidator>

</tr>

</td>

<%--__________________________________________________ __________________________--%>

<%--Row 9--%>

<tr>

<td<font face="Verdana" Size="2">Was employee trained in the appropriate
use of Personal Protective Equipment/Proper safety procedures?

<br>

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=EmpTrain
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server"
Text="You need to select yes or no"

ControltoValidate="EmpTrain" InitialValue=""></asp:RequiredFieldValidator>

</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 10--%>

<tr>

<td<font face="Verdana" Size="2">

Was employee cautioned for failure to use Personal Protective
Equipment/Proper safety procedures? <br>

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=EmpCaution
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorCaution"
runat="server"

Text="You need to select yes or no" ControlToValidate="EmpCaution">

</asp:RequiredFieldValidator>


</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 11--%>

<tr>

<td<font face="Verdana" Size="2">

Did employee promptly report the injury?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=EmpReport
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorReport" runat="server"

Text="You need to select yes or no" ControlToValidate="EmpReport">

</asp:RequiredFieldValidator>
</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 12--%>

<tr>

<td<font face="Verdana" Size="2">Is there modified duty available?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=ModifiedDuty
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorModified"
runat="server"

Text="You need to select yes or no" ControlToValidate="ModifiedDuty">

</asp:RequiredFieldValidator>
</td>

</tr>

<%--__________________________________________________ __________________________--%>

<%--Row 12--%>

</table>

<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">

<td width="400"><font face="Verdana" Size="2"Name of person submitting
this form:

<asp:textbox id="Submitter" runat=server columns="40"/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorSubmit" runat="server"

Text="You must enter name" ControlToValidate="Submitter">

</asp:RequiredFieldValidator>

</td>
<td<font face="Verdana" Size="2">Today's Date: <asp:textbox id="Today"
runat=server columns="10"/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorToday" runat="server"

Text="You must enter today's date" ControlToValidate="Today">

</asp:RequiredFieldValidator>
</td>

</tr>

<tr>

<td>

<asp:Button id="btnSendMail" text="Submit" OnClick="btnSendMail_OnClick"
runat="server" />

</td>

</tr>

<td valign=top<table cellpadding=20><tr><td<asp:ValidationSummary
ID="valSum" runat="server" HeaderText="You must enter a value in the
following fields:" Font-Name="verdana" Font-Size="12" /</td>

</form>

</body>

</html>


"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:eB**************@TK2MSFTNGP03.phx.gbl...
"dancer" <da****@microsoft.comwrote in message
news:e3**************@TK2MSFTNGP05.phx.gbl...
>Using Framework 1.1 and Asp.Net

Does the Asp control Validation Summary work in 1.1?

Yes:
http://msdn2.microsoft.com/en-us/lib...6h(vs.71).aspx
--
http://www.markrae.net

Jun 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
4
by: gsb58 | last post by:
Hi! On a form I have a calendar. The form is rezised to 1024x768 (Don't worry - this is a training case) when loaded. Now I want to center the calendar on the form so that its edges are...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.