miércoles, 19 de marzo de 2014

C# - Dates

How to parse a Date


DateTime tg2 = DateTime.Parse(txtTG2.Text, System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));


How to parse date in a textBox using a calendar


 <asp:TextBox ID="txtTG4" runat="server" Text="" CssClass="capture" Style="width: 75px;" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate="txtTG4" runat="server" ErrorMessage="*Required" CssClass="validator" ValidationGroup="save" />
                                    <ajaxCTK:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTG4" PopupPosition="TopLeft" />
                                    <ajaxCTK:MaskedEditExtender ID="mskTg4" runat="server" Mask="99/99/9999" MaskType="Date" CultureName="en-US"
                                        TargetControlID="txtTG4" ErrorTooltipEnabled="true" AutoComplete="false">
                                    </ajaxCTK:MaskedEditExtender>
                                    <ajaxCTK:MaskedEditValidator ID="MaskedEditValidator5"
                                        runat="server" ValidationGroup="save"
                                        ControlExtender="mskTg4"
                                        ControlToValidate="txtTG4"
                                        InvalidValueMessage="Date is invalid"
                                        IsValidEmpty="True" />

No hay comentarios:

Publicar un comentario