GridDateTimeColumn Required field validator not firing in batch edit mode

5 posts, 0 answers
  1. Gareth
    Gareth avatar
    12 posts
    Member since:
    Aug 2012

    Posted 02 Jul 2014 Link to this post

    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>
     

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 07 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 12 Mar 2015 in reply to Kostadin Link to this post

    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).
  5. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 13 Mar 2015 in reply to Peter Link to this post

    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>

















  6. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 17 Mar 2015 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017