PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Can't code RegularExpressionValidator correctly
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Can't code RegularExpressionValidator correctly
![]() |
Can't code RegularExpressionValidator correctly |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi All,
I coding a simple web form that generates - a couple of operand textboxes, - a dropdown list of operations - a "results" textbox - an "error msg" label The following code validates the operations list correctly. However, it doesn't output any message when the first operand is blank. What do I need to do to get the operand validation to output to lblMessage when operand #1 is blank. Should I just copy and paste the corrected code to perform the same check on operand #2? ============== private void btnEquals_Click(object sender, System.EventArgs e) { RegularExpressionValidator rev = new RegularExpressionValidator(); rev.ControlToValidate="tbOperand1"; rev.ValidationExpression="^\\d+$"; rev.ErrorMessage="The operands must contain only digits and at least one"; rev.Visible=true; rev.Validate("tbOperand1"); if (cbOperation.SelectedItem.Text == "?") { lbMessage.Text = "Please select an operation in place of \"?\""; return; } } ============== Regards, Richard |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi All,
I found what I needed: a ValidationSummary tag. Found it in Prosise's "Programming Microsoft .NET" Regards, Richard |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

