I have a form where one field needs to check if the person is up to 17 years of age by between 01/01/2011 and 12/31/2011.
So I added a a Range Validator and Validator Callout Extender
How can I get the page to check this range when the user enters in their dob in the dob textbox then when they go and enter a date in the bmidte box (if they are over 17 years of age) I want my error message to apper.
Here's the aspx page code:
RangeValidatorBMIDte.MinimumValue = "01/01/2011"
RangeValidatorBMIDte.MaximumValue = "12/31/2011"
RangeValidatorBMIDte.ErrorMessage = "Date Entered is NOT Valid. Value needs to be between 01/01/2011 and 12/31/2011."
12/31.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Adult BMI</title>
<style type="text/css">
.style1
{
color: #FFFFFF;
font-weight: bold;
font-family:Lucida Console;
font-size:20px;
}
.style5
{
color:#000000;
font-family:Tahoma;
font-size:14px;
}
#Text1
{
width: 300px;
}
.style6
{
width: 100%;
}
.style7
{
color: #000000;
font-family: Tahoma;
font-size: 14px;
height: 46px;
}
</style>
</head>
<body>
</div>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="scriptmanager1" runat="server"> </asp:ToolkitScriptManager>
<div>
<table style="width:75%;" align="center" border="1">
<tr>
<td colspan="2" align="right" valign="top">
<table class="style6">
<tr>
<td>
<a href="CMSPortal.aspx"><img align="left" src="images/back5.jpeg" border="0"/></a></td>
<td rowspan="2">
<img src="images/CMS%20Logo.png"
style="width: 162px; height: 90px; float: right;" /></td>
</tr>
<tr>
<td align="left" valign="bottom">
<asp:TextBox ID="Dtetxt" runat="server" Height="21px" Width="155px"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#2A6F81" >
<center class="style1">ADULT BMI</center></td>
</tr>
<tr>
<td class="style5" bgcolor="#D6E3BC">
MRID</td>
<td bgcolor="#D6E3BC" >
<input id="Text1" type="text" /></td>
</tr>
<tr>
<td class="style5" bgcolor="#D6E3BC">
Birthdate:
<asp:TextBox ID="dob" runat="server"></asp:TextBox></td>
<td bgcolor="#D6E3BC" >
</td>
</tr>
<tr>
<td class="style5" valign="top" bgcolor="#D6E3BC">
1. Was there an outpatient visit for this member during the measurement year (2011) or the year prior to the
measurement year?</td>
<td class="style5" align="left" bgcolor="#D6E3BC">
<asp:RadioButtonList ID="OutVisitRtb" runat="server"
RepeatDirection="Horizontal" AutoPostBack="True">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="style7" bgcolor="#D6E3BC">
2. Is there a BMI (or BMI percentile for members under age 19) documented in the
medical record on or between 01/01/2010 - 01/01/2011?</td>
<td class="style7" valign="top" bgcolor="#D6E3BC">
<asp:RadioButtonList ID="BMIRbn" runat="server" RepeatDirection="Horizontal"
AutoPostBack="True">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="style5" valign="top" bgcolor="#D6E3BC">
3. Date of BMI (or BMI percentile for members under age 19) </td>
<td bgcolor="#D6E3BC">
<asp:TextBox ID="BMIdte" runat="server" style="font-family: Tahoma"></asp:TextBox>
<img id="images1" src="images/calendar.gif" style="width: 29px; height: 29px" alt="calendar"
align="bottom" />
<asp:RangeValidator ID="RangeValidatorBMIDte" runat="server" ErrorMessage="RangeValidator">*</asp:RangeValidator>
<asp:ValidatorCalloutExtender ID="RangeValidatorBMIDte_ValidatorCalloutExtender"
runat="server" Enabled="True" TargetControlID="RangeValidatorBMIDte">
</asp:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td class="style5" valign="top" bgcolor="#D6E3BC">
4a. Enter BMI value
<br />
<br />
4b. Enter BMI percentile (only if member under age 19)</td>
<td class="style5" bgcolor="#D6E3BC">
<asp:TextBox ID="BMIVal" runat="server" AutoPostBack="True"></asp:TextBox>
%<br />
<asp:TextBox ID="BMIPerctxt" runat="server" AutoPostBack="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5" valign="top" bgcolor="#D6E3BC">
5. If the member is female, was there a diagnosis of pregnancy in 2010 or 2011?</td>
<td class="style5" bgcolor="#D6E3BC">
<asp:RadioButtonList ID="GenderRbn" runat="server"
RepeatDirection="Horizontal" style="font-family: Tahoma">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
<asp:ListItem Value="M">X - Male</asp:ListItem>
</asp:RadioButtonList>(Select X if member is a male)
</td>
</tr>
<tr>
<td class="style5"colspan="2" valign="top" bgcolor="#D6E3BC">
Comments: <asp:TextBox ID="Commtxt" runat="server"
Height="166px" Width="730px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" valign="top" style="text-align: center" bgcolor="#D6E3BC">
<asp:Button ID="Button1" runat="server" Text="Submit"
style="font-family: Tahoma" />
<asp:Button ID="Button2" runat="server" Text="Clear"
OnClientClick="this.form.reset();return false;" style="font-family: Tahoma"/>
</td>
</tr>
</table>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="BMIdte"
WatermarkCssClass="watermarked" WatermarkText="MM/DD/YYYY">
</asp:TextBoxWatermarkExtender>
<asp:CalendarExtender ID="CalendarExtender1" TargetControlID="BMIdte" PopupButtonID="images1" runat="server">
</asp:CalendarExtender>
</div>
</form>
<p class="style5" style="text-align: center">
Complete Medical Services, LLC, Patient Care Quality Assessment</p>
</body>
</html>
Here's the code behind page:
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Dtetxt.Text = Date.Now
RangeValidatorBMIDte.MinimumValue = "01/01/2011"
RangeValidatorBMIDte.MaximumValue = "12/31/2011"
RangeValidatorBMIDte.ErrorMessage = "Date Entered is NOT Valid. Value needs to be between 01/01/2011 and 12/31/2011."
End Sub