Hi all,
I want to validate the text box in gridview for date format.
how can I do this.
Thanks in Advance
Hi all,
I want to validate the text box in gridview for date format.
how can I do this.
Thanks in Advance
in grid view use textbox control like this:-
<templatefiled>
<itemtemplate>label<itemtemplate>
<edittemplate>textbox<edittemplate>
</templatefield>
in textbox
use this code
<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="Date must be in the form DD/MM/YYYY"
ControlToValidate="tbDiaryDateDue"
ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
Display="Dynamic"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator2" runat="server" ErrorMessage="Date must be in the form D/M/YYYY"
ControlToValidate="tbDiaryDateDue"
ValidationExpression="([1-9]|[12][0-9]|3[01])[- /.]([1-9]|1[012])[- /.](19|20)\d\d"
Display="Dynamic"></asp:RegularExpressionValidator>
Thanks to Mind Bird,
For you reply.
It works.
thank you
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.