This is a migrated thread and some comments may be shown as answers.

GridDateTimeColumn Required field validator not firing in batch edit mode

4 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gareth
Top achievements
Rank 1
Gareth asked on 02 Jul 2014, 01:12 PM
Hi,

I'm currently trying to implementing a rad grid with in line batch editing.

I have a GridDateTimeColumn with an associated RequiredFieldValidator

If I leave the datepicker empty and select to add a new row to the table the validator is not firing as expected. Therefore I am incorrectly able to add multiple rows with no date entered
Note that required field validators on other columns are firing correctly in this instance. it only appears to be an issue with the date picker


If however I enter a date in the date picker, and then remove it, the validator is firing  and I cannot add a new row (as expected)
Further to this if I re-enter the date, select to add a new row and then try to add an additional row without entering a date then the validator is firing in this scenario

Have you any advice on how the required field validator should be implemented to fire when adding a new row??

below is my column definition

<telerik:GridDateTimeColumn DataField="Date" HeaderStyle-Width="135px" HeaderText="Date" ColumnEditorID="dateEditor" 
 
                        SortExpression="Date" UniqueName="Date" PickerType="DatePicker" >
                        <ColumnValidationSettings EnableRequiredFieldValidation="True"  >
                            <RequiredFieldValidator  ForeColor="Red" ErrorMessage="This field is required"  ID="reqDateVal" ></RequiredFieldValidator
                        </ColumnValidationSettings
                     </telerik:GridDateTimeColumn>
 

4 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 07 Jul 2014, 07:12 AM
Hi Gareth,

I try to reproduce the issue which you are facing but to no avail. I attached a small sample where I used a RequiredFiledValidator and on my side it gets fired if I do not select a date from the DatePicker control. Please give the sample a try and let me know how it differs from your real setup. Additionally I test it with the latest version of the RadControls which is Q2 2014.

I am looking forward to your reply.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Peter
Top achievements
Rank 1
answered on 13 Mar 2015, 03:57 AM
My issue is slightly different - the RequiredFieldValidator never fires and the date "01/01/0001" is displayed. Other validators work on the grid (e.g. GridBoundColumn).
0
Peter
Top achievements
Rank 1
answered on 13 Mar 2015, 07:35 AM
As I had separate Validation Groups / Multiple Grids I had to:

1. On the grid, set <ValidationSettings EnableValidation="true" ValidationGroup="MyValidationGroup" />
2. On the control, repeat the ValidationGroup:

<ColumnValidationSettings EnableRequiredFieldValidation="true">
                                                    <RequiredFieldValidator Enabled="true" ForeColor="Red" ErrorMessage="required" Text="* required" ValidationGroup="SiteComplianceReview" />
                                                </ColumnValidationSettings>

3. Just in case, include separate ValidationSummary in the AJAX:

        <telerik:AjaxSetting AjaxControlID="rgGrid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgGrid" />
                <telerik:AjaxUpdatedControl ControlID="vsGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>

















0
Kostadin
Telerik team
answered on 17 Mar 2015, 11:07 AM
Hello Peter,

Could you please try replicating the issue in the previously provided sample since I was unable to do it? I used your ColumnValidationSettings and on my side the validation is fired when no date is entered.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Gareth
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Peter
Top achievements
Rank 1
Share this question
or