Click here to Skip to main content
15,662,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

i want to create a multiline textbox that should have 200 as maxlength and also shuoul be a mandatroy field

<<pre lang="cs">asp:RegularExpressionValidator ID="rgConclusionValidator2" ControlToValidate="txtDesc"
ErrorMessage="Special instruction can't exceed 200 characters" ValidationExpression="^[\s\S]{0,20}$"
runat="server" Display="None" SetFocusOnError="true" />



i am using this but the error message is not displayed,only focus is coming to the textfield.
also how to make it madatory
Posted

Hi,


XML
<asp:TextBox ID="txtRemarks" runat="server"  MaxLenth="200" TextMode="MultiLine"></asp:TextBox>

<asp:RequiredFieldValidator runat="server" ID="rfvtxtRemarks" Display="None" ErrorMessage="Please enter Remarks" ControlToValidate="txtRemarks"></asp:RequiredFieldValidator>
                                       
 <cc1:ValidatorCalloutExtender runat="server" ID="vcetxtRemarks" TargetControlID="rfvtxtRemarks"                                            Width="200" PopupPosition="TopLeft">
  </cc1:ValidatorCalloutExtender>



I think it will work for u ...........
 
Share this answer
 
Where you have mentioned Display="none" see below
runat="server" Display="None" SetFocusOnError="true" />

Just delete Display="None" and test it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900