0

I can't figure out why this isn't working:

<td><asp:TextBox ID="TextBox_Tracking_BenOpt" runat="server" AutoPostBack="True" 
         Height="16px" Width="100px"></asp:TextBox>
<AJAXControls:MaskedEditExtender ID="MeeBenOpt" runat="server" Mask="AAAAA" 
              MaskType="None" TargetControlID="TextBox_Tracking_BenOpt" 
              PromptCharacter="_" InputDirection="LeftToRight" 
              Filtered="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" />
<asp:RegularExpressionValidator Display="Dynamic" 
              ControlToValidate="TextBox_Tracking_BenOpt" ID="RevBenOpt" 
              ValidationExpression="^[0-9A-Z]{5,}$" runat="server" ErrorMessage="X" 
              ForeColor="Red" Font-Size="Large"></asp:RegularExpressionValidator></td> 

It works in that it only allows 5 characters and they're alphanumeric, but I only want to allow numbers and upper-case letters. How do I get rid of the lower-case letters?

Johnny Bones
  • 8,786
  • 7
  • 52
  • 117
  • I can't believe that doesn't work - but for the time being, could you cast the value to upper-case in the code-behind as a workaround? – Brian Mains Oct 20 '15 at 18:15
  • Looks like I'm going to have to. I'm stumped, and I agree I thought the above code should work but it lets me enter lowercase letters. – Johnny Bones Oct 20 '15 at 18:27
  • that looks really difficult compared to a simple key up and lose focus event in javascript... For maximum results do both..? – Adam Heeg Oct 20 '15 at 18:55
  • Well, the idea behind validators (and extenders) is that you shouldn't need separate javascript since it should natively limit what you're allowed to enter. It's just weird that it's not working, and rather than write extra code I was just hoping maybe I missed something in the expression. – Johnny Bones Oct 20 '15 at 19:26

0 Answers0