<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
protected void SearchButton_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
</script>
Use the buttons to invoke validation which changes the styles.<br/>
The <b>Text To Find</b> field only changes the label, making it bold. The other fields
change their label to bold and the background color of enclosing panels.<br/>
<des:PageManager ID="PageManager1" runat="server" HiliteFieldsNearbyError="True" />
<des:RequiredFieldsDescription ID="RequiredFieldsDescription1" runat="server" /><br/><br/>
<asp:Label ID="SearchTextLabel" runat="server">Text to find: </asp:Label>
<asp:TextBox ID="SearchText" runat="server" Width="200px" />
<des:RequiredTextValidator ID="rtvSearchText" runat="server" ControlIDToEvaluate="SearchText"
ErrorMessage="Required" ShowRequiredFieldMarker="true"
Group="Search"
Label-LabelControlID="SearchTextLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:AlertImageErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
</des:RequiredTextValidator>
<des:Button ID="SearchButton" runat="server" Text="Search now" OnClick="SearchButton_Click"
Group="Search" /><br/>
<hr/>
<asp:Panel ID="YourNamePanel" runat="server">
<asp:Label ID="YourNameLabel" runat="server">Your Name:</asp:Label>
<des:FilteredTextBox ID="YourName" runat="server" Width="200px"
LettersLowercase="true" LettersUppercase="true" Space="true" DiacriticLetters="true" OtherCharacters=",." />
<des:RequiredTextValidator ID="rtvYourName" runat="server" ControlIDToEvaluate="YourName"
ErrorMessage="Required" SummaryErrorMessage="Your Name is required" ShowRequiredFieldMarker="true"
Group="Data"
Label-LabelControlID="YourNameLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:TextErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
<HiliteFields>
<des:ControlConnection ControlID="YourNamePanel" />
</HiliteFields>
</des:RequiredTextValidator>
<des:CharacterValidator ID="CharacterValidator1" runat="server" ControlIDToEvaluate="YourName"
ErrorMessage="Illegal character entered." SummaryErrorMessage="Illegal character entered in Your Name."
Group="Data"
Label-LabelControlID="YourNameLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:TextErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
<HiliteFields>
<des:ControlConnection ControlID="YourNamePanel" />
</HiliteFields>
</des:CharacterValidator>
</asp:Panel>
<br/>
<asp:Panel ID="YourAgePanel" runat="server">
<asp:Label ID="YourAgeLabel" runat="server">Your Age:</asp:Label>
<des:IntegerTextBox ID="Age" runat="server" Width="40px"
ShowSpinner="true" MinValue="1" MaxValue="120" />
<des:RequiredTextValidator ID="rtvAge" runat="server" ControlIDToEvaluate="Age"
ErrorMessage="Required" SummaryErrorMessage="Your age is required" ShowRequiredFieldMarker="true"
Group="Data"
Label-LabelControlID="YourAgeLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:TextErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
<HiliteFields>
<des:ControlConnection ControlID="YourAgePanel" />
</HiliteFields>
</des:RequiredTextValidator>
<%-- NOTE: You can omit the DataType property for any of DES's data type oriented textboxes.--%>
<des:DataTypeCheckValidator ID="DataTypeCheckValidator1" runat="server" ControlIDToEvaluate="Age"
ErrorMessage="Enter a number" SummaryErrorMessage="Enter a number in Your Age" DataType="Integer"
Group="Data"
Label-LabelControlID="YourAgeLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:TextErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
<HiliteFields>
<des:ControlConnection ControlID="YourAgePanel" />
</HiliteFields>
</des:DataTypeCheckValidator>
<%-- NOTE: When using DES numeric textbox, you can omit the Minimum and Maximum
properties if you already set the range on the textbox's MinValue and MaxValue properties.
You also can omit the DataType property for any of DES's data type oriented textboxes.--%>
<des:RangeValidator ID="RangeValidator1" runat="server" ControlIDToEvaluate="Age"
ErrorMessage="Between {MINIMUM} and {MAXIMUM}" SummaryErrorMessage="Your Age must be between {MINIMUM} and {MAXIMUM}"
DataType="Integer"
Minimum="1" Maximum="120"
Group="Data"
Label-LabelControlID="YourAgeLabel" Label-TrimTrailingSymbol="true" >
<ErrorFormatterContainer>
<des:TextErrorFormatter Display="Dynamic" />
</ErrorFormatterContainer>
<HiliteFields>
<des:ControlConnection ControlID="YourAgePanel" />
</HiliteFields>
</des:RangeValidator>
</asp:Panel>
<br/>
<hr/>
<des:Button ID="Submit" runat="server" Text="Submit" OnClick="Button1_Click"
Group="Data"/>
<des:Button ID="Cancel" runat="server" Text="Cancel" CausesValidation="false" />
<input type="reset" id="Reset" runat="server" value="Reset" />
<br/><br/>
<des:ValidationSummary ID="ValidationSummary1" runat="server"
HeaderText="Fix these errors"
Group="Data" />