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

Fire Validation on Batch Add Record Together

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 20 Aug 2014, 05:06 PM
Hey everyone,

I am attempting to validate a number of fields within the "Add New Record" functionality while in "EditMode = Batch". Each GridBoundColumn has its own ColumnValidationSettings and RequiredFieldValidator. The validation message is displayed for two fields, but for four other fields no such message is displayed. Pressing "Save Changes" still requires all of the six fields to contain a value, regardless of whether a validation message is displayed or not. Furthermore, the validation messages are displayed one at a time. What is the best way to validate the field within my scenario? I want all required fields to show their validation message (if the fields are empty) once "Save Changes" is selected. I will include my current attempt that was based off a Batch Edit validation demo. I appreciate all the help I can get. Thanks!

GridBoundColumn w/ Validation (ASPX):
<telerik:GridBoundColumn DataField="Status_Field" UniqueName="Status_Field" HeaderText="Status"
    FilterControlWidth="83px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
    ShowFilterIcon="false">
    <ColumnValidationSettings EnableRequiredFieldValidation="true">
        <RequiredFieldValidator ErrorMessage="This field is required!" Display="Dynamic"
            ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
    </ColumnValidationSettings>
</telerik:GridBoundColumn>

Entire RadGrid (ASPX):
<telerik:RadGrid ID="RadGridActionItem" runat="server" AllowSorting="True" AllowPaging="true"
    AllowFilteringByColumn="True" OnNeedDataSource="RadGridActionItem_NeedDataSource"
    OnPageIndexChanged="RadGridActionItem_PageIndexChanged" OnItemCreated="RadGridAction_ItemCreated"
    OnDeleteCommand="RadGridActionItem_DeleteCommand" OnInsertCommand="RadGridActionItem_InsertCommand"
    OnBatchEditCommand="RadGrid1_BatchEditCommand" AllowAutomaticUpdates="True" AllowMultiRowEdit="True"
    OnItemDataBound="RadGridActionItem_ItemDataBound" Width="80%" HorizontalAlign="Center"
    PageSize="15" EnableViewState="true" Skin="Windows7">
    <GroupingSettings CaseSensitive="false" />
    <MasterTableView AutoGenerateColumns="false" ShowFooter="true" DataKeyNames="Action_Item_Id"
        ClientDataKeyNames="Action_Item_Id" CommandItemDisplay="Top" Width="100%" HorizontalAlign="Center"
        EditMode="Batch">
        <BatchEditingSettings OpenEditingEvent="None" EditType="Row" />
        <Columns>
            <telerik:GridNumericColumn DataField="Action_Item_Id" UniqueName="Action_Item_Id"
                HeaderText="Action Item ID" ForceExtractValue="Always" FilterControlWidth="75px"
                AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridNumericColumn>
            <telerik:GridNumericColumn DataField="Result_Id" UniqueName="Result_Id" HeaderText="Result ID"
                FilterControlWidth="65px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
            </telerik:GridNumericColumn>
            <telerik:GridBoundColumn DataField="Related_Result_Id" UniqueName="Related_Result_Id"
                HeaderText="Related Result ID" FilterControlWidth="75px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Status_Field" UniqueName="Status_Field" HeaderText="Status"
                FilterControlWidth="83px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="This field is required!" Display="Dynamic"
                        ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Assigned_To" UniqueName="Assigned_To" HeaderText="Assigned To"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="Open_Date" UniqueName="Open_Date" HeaderText="Open Date"
                FilterControlWidth="80px" AutoPostBackOnFilter="true" PickerType="DatePicker"
                EnableTimeIndependentFiltering="true" ShowFilterIcon="true" DataFormatString="{0:M/d/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn DataField="Due_Date" UniqueName="Due_Date" HeaderText="Due Date"
                FilterControlWidth="80px" AutoPostBackOnFilter="true" PickerType="DatePicker"
                EnableTimeIndependentFiltering="true" ShowFilterIcon="true" DataFormatString="{0:M/d/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Title" UniqueName="Title" HeaderText="Title"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="This field is required!" Display="Dynamic"
                        ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Source" UniqueName="Source" HeaderText="Source"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="Required!" Display="Dynamic" ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Employee_Id" UniqueName="Employee_Id" HeaderText="Employee ID"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="Required!" Display="Dynamic" ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="User_System_Id" UniqueName="User_System_Id" HeaderText="User System ID"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="Required!" Display="Dynamic" ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="System" UniqueName="System" HeaderText="System"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                    <RequiredFieldValidator ErrorMessage="Required!" Display="Dynamic" ValidationGroup="NewRecordValidation"></RequiredFieldValidator>
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Comparison_Type" UniqueName="Comparison_Type"
                HeaderText="Comparison Type" FilterControlWidth="80px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Actual_Access_Level" UniqueName="Actual_Access_Level"
                HeaderText="Actual Access Level" FilterControlWidth="90px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Auth_Access_Level" UniqueName="Auth_Access_Level"
                HeaderText=" Auth Access Level" FilterControlWidth="90px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Investigation_Results" UniqueName="Investigation_Results"
                HeaderText="Investigation Results" FilterControlWidth="150px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Historical_Authorization_Ticket" UniqueName="Historical_Authorization_Ticket"
                HeaderText="Historical Auth Ticket" FilterControlWidth="100px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Historical_Provisioning_Ticket" UniqueName="Historical_Provisioning_Ticket"
                HeaderText="Historical Prov Ticket" FilterControlWidth="100px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Resolution_Steps" UniqueName="Resolution_Steps"
                HeaderText="Resolution Steps" FilterControlWidth="150px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Resolution_Authorization_Ticket" UniqueName="Resolution_Authorization_Ticket"
                HeaderText="Resolution Auth Ticket" FilterControlWidth="100px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Resolution_Provisioning_Ticket" UniqueName="Resolution_Provisioning_Ticket"
                HeaderText="Resolution Prov Ticket" FilterControlWidth="100px" AutoPostBackOnFilter="true"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Batch_Name" UniqueName="Batch_Name" HeaderText="Batch Name"
                FilterControlWidth="70px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="QC_Review" UniqueName="QC_Review" HeaderText="QC/Review"
                DataType="System.Boolean" AllowFiltering="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Reviewed_By" UniqueName="Reviewed_By" HeaderText="Reviewed_By"
                FilterControlWidth="80px" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="Review_Date" UniqueName="Review_Date" HeaderText="Review Date"
                FilterControlWidth="80px" AutoPostBackOnFilter="true" PickerType="DatePicker"
                EnableTimeIndependentFiltering="true" ShowFilterIcon="true" EmptyDataText=" "
                DataFormatString="{0:M/d/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn DataField="Resolved_Date" UniqueName="Resolved_Date"
                HeaderText="Resolved Date" FilterControlWidth="80px" AutoPostBackOnFilter="true"
                PickerType="DatePicker" EnableTimeIndependentFiltering="true" ShowFilterIcon="true"
                DataFormatString="{0:M/d/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton"
                ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to delete this action item?" />
        </Columns>
        <SortExpressions>
            <telerik:GridSortExpression FieldName="Action_Item_Id" SortOrder="Descending" />
        </SortExpressions>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnRowContextMenu="RowContextMenu" />
        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2">
        </Scrolling>
        <Selecting AllowRowSelect="True"></Selecting>
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
</telerik:RadGrid>

I have also included an image of my error.

Thanks again,
Matt

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 23 Aug 2014, 08:03 AM
Hello Matthew,

The way that Batch Editing is implemented will not allow such behavior, where all the validators will display their error message at once. This is due to the fact that when the focus is lost and the validation fails, grid will internally prevent the closing of the cell/row and will keep it in edit mode. 

Nevertheless, you could create an item in our Ideas & Feedback Portal with this feature request, so our developers could investigate this further and determine if such behavior could be achieved, and if so, introduce it in one of our future releases. Following is a link to the portal:

Best Regards,
Konstantin Dikov
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
Matthew
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or