I need Date validations

Posted by Jayakumars under Regular Expressions on 8/16/2011 | Points: 10 | Views : 3639 | Status : [Member] [MVP] | Replies : 8
my code like this in GridView Control also check my image file below


<asp:TemplateField HeaderText="Bill Date">
<ItemTemplate>
<asp:TextBox ID="TxtStudentBillDate" runat="server" Text ='<%# Eval("BillDate") %>' CssClass="TxtBoxWidth"></asp:TextBox>

<asp:Image ID="ImgCal" runat="server" ImageUrl="~/images/Calendar.png" CssClass="calendersstyle" />

<asp:RequiredFieldValidator ID="Req" runat="server" ValidationGroup="StudentBillDet" Display ="Dynamic"
ControlToValidate="TxtStudentBillDate" ErrorMessage="*">
</asp:RequiredFieldValidator>

<asp:MaskedEditValidator ID="MaskedEditValidator3" runat="server" ControlExtender="MaskedEditExtenderSD2"
ControlToValidate="TxtStudentBillDate" Display="Dynamic" EmptyValueBlurredText="*"
ValidationGroup="StudentBillDet" ErrorMessage="MaskedEditValidator10" InvalidValueBlurredMessage="(dd/mm/yyyy)"
InvalidValueMessage="Valid DOA required" IsValidEmpty="False" ValidationExpression="^\d{2}/\d{2}/\d{4}$">(dd/mm/yyyy)
</asp:MaskedEditValidator>
<asp:CalendarExtender ID="CalendarExtenderSD2" runat="server" Enabled="True" Format="dd/MM/yyyy"
PopupButtonID="ImgCal" CssClass="ajax__calendar_container" TargetControlID="TxtStudentBillDate">
</asp:CalendarExtender>
<asp:MaskedEditExtender ID="MaskedEditExtenderSD2" runat="server" ClearMaskOnLostFocus="False"
Enabled="True" Mask="99/99/9999" MaskType="Date" TargetControlID="TxtStudentBillDate"
CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat=""
CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
CultureTimePlaceholder="" CultureName="pt-BR">
</asp:MaskedEditExtender>


</ItemTemplate>
<HeaderStyle Width="150px" />
</asp:TemplateField>


but every row i am update but my issue when i click first row my code fire
also 2 row already i will write requirefield so both row fired how to restrict
check below my image file

Mark as Answer if its helpful to you


Responses

Posted by: Itorian on: 8/16/2011 [Member] Starter | Points: 25

Up
0
Down
do u mean, duplication of rows appears in db? is this so?

Student of M.Tech IT | Microsoft MVP | Mindcracker MVP | IT Faculty | Blogger | Author

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jpchoudhari on: 8/17/2011 [Member] Starter | Points: 25

Up
0
Down
your requirement is not clear... can you explain little more exact

Kind Regards,
Jay

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Johnbhatt on: 6/22/2012 [Member] Starter | Points: 25

Up
0
Down
Why don't you Use JavaScript for Data Validation. I use Date Autocompletion which automatically change date to dd/MM/yyyy hh:mm even user Type dd/mm or d/m or any relevant date format.

I am Sending you a code snippet:
<asp:TextBox ID="txtBkgDate" runat="server" ToolTip="Booking Date" onblur="ConvertToDate(this,false)"

Height="19px" Width="124px"></asp:TextBox>

This is code where you need Date and JS File is Attached.
Include JS Page in ASPX Head Section and add following code anywhere in Page you need on onblur event.
onblur="ConvertToDate(this,false)"


You can even compare dates while parsed from this method. No need to use Ajax and other things.
 Download source file

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 6/29/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi.

Try this...


        <asp:TextBox ID="txtF_DOB" runat="server" Style="width: 100px;"

MaxLength="10"></asp:TextBox>

<asp:RegularExpressionValidator ID="REV_txtF_DOB" runat="server" ControlToValidate="txtF_DOB"
ErrorMessage="Enter valid Date!" ValidationExpression="^((0[1-9]|[1-2][0-9]|3[0-1])[/-](0[1-9]|(10|11|12)))[/-][0-9]{4}$"
SetFocusOnError="True" ></asp:RegularExpressionValidator>


ValidationExpression="^((0[1-9]|[1-2][0-9]|3[0-1])[/-](0[1-9]|(10|11|12)))[/-][0-9]{4}$"

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Johnbhatt on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi, R. Jaykumar

Hope you have solved your query. Now please close forum thread by marking as Answer.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muralidosscm on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/3882/ASP-NET-Validators-Unclouded

Regards
Muralidoss M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gaur1982 on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
you can find lots of Regular Validation Expression on this link : http://www.regexlib.com/Search.aspx?k=date

Gaurav Agrawal
http://www.planetofcoders.com/

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dylanrodriguez on: 7/13/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Guys.

If you have a database of some type and need to create ASP.NET web pages to allow users to list, add, edit or delete records from that database, you have a couple of choices. One way is to design and code all the pages yourself (making use of any existing routines you may have). That can be very involved -- not only do you have to create the user interface, you also have to figure out the best way to access the database, provide for user authentication, web site security, reporting, data import and export -- a whole list of necessary features. In many cases there may be an easier way -- an ASP.NET code generator.

All your comment for programming development are welcome.

For More Info :- www.aegisisc.com

Thanks in advance.


http://www.aegisisc.com/sharepoint-developers.html

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response