In my FormTemplate I have a RadDateTimePicker that is validated using a RequiredFieldValidator. I use a custom Updatebutton to save the fields. The user is required to provide a date in the RadDateTimePicker. The validation does appear to work and the user gets an error message if they fail to provide a date. The problem is, is that the ItemCreated event on the server-side still gets fired when the user presses the Update button. Why is this happening? The grid shouldn't be performing any postbacks when a RequiredFieldValidator indicates that the user must provide input. The whole point of having the validation done on the client-side is to avoid a postback of any kind to the server. Here is the code in my FormTemplate:
| <FormTemplate> |
| <table id="tableSessionDetails" cellpadding="5px" cellspacing="0" border="0" style="width: 100%; |
| margin-top: 10px; margin-left: 5px"> |
| <tr> |
| <td style="width: 120px"> |
| <asp:Label ID="lblSessionDate" runat="server" Text="Session Date:" CssClass="RadGridDetailsLabel"></asp:Label> |
| </td> |
| <td> |
| <telerik:RadDateTimePicker ID="RadDateTimePickerSessionDate" runat="server" Skin="Sunset"> |
| </telerik:RadDateTimePicker> |
| <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="RadDateTimePickerSessionDate" |
| ErrorMessage="This field is required" runat="server"> |
| </asp:RequiredFieldValidator> |
| </td> |
| </tr> |
| </table> |
| <table cellpadding="0" cellspacing="0" border="0" style="margin: 10px; width: 100%"> |
| <tr> |
| <td align="right" style="padding-right: 20px; padding-bottom: 10px"> |
| <asp:ImageButton ID="imgUpdate" runat="server" ImageUrl="~/images/Update.gif" ToolTip="Update Record" |
| Style="padding-right: 5px" CommandName="Update" /> |
| <asp:ImageButton ID="imgCancel" runat="server" ImageUrl="~/images/Cancel.gif" ToolTip="Cancel Editing" |
| CommandName="Cancel" /> |
| </td> |
| </tr> |
| </table> |
| </FormTemplate> |