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

Rad Grid Batch Editing Validation not working

6 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 23 Feb 2016, 12:32 PM

Hi,

Telerik Team ,

    I am facing validation related problem in Rad Grid (Batch Editing). It seems that validation is not working as expected .Please help me on the same.
My current telerik verion is '2015.2.826.45'. Please let me know whether this version supports validation or need to update it to never version .

sample code

 

 

<telerik:RadGrid ID="EmployeeRadGrid" GridLines="None" runat="server" Width="99.3%" PageSize="10"
                AutoGenerateColumns="False"
                AllowAutomaticInserts="True"
                AllowAutomaticDeletes="True"
                AllowAutomaticUpdates="True"
                AllowSorting="false"
                AllowPaging="True"
                OnPreRender="EmployeeRadGrid_PreRender"
                OnNeedDataSource="EmployeeRadGrid_NeedDataSource"
                OnBatchEditCommand="EmployeeRadGrid_BatchEditCommand"
                OnPageIndexChanged="EmployeeRadGrid_PageIndexChanged"
                OnPageSizeChanged="EmployeeRadGrid_PageSizeChanged"
                 
                >
                <MasterTableView CommandItemDisplay="TopAndBottom" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False" CommandItemSettings-ShowRefreshButton="false" ValidateRequestMode="Enabled" >
                    <BatchEditingSettings EditType="Row" />
                    <Columns>
                        <telerik:GridBoundColumn DataField="EmployeeNumber" HeaderStyle-Width="15%" HeaderText="Employee Number" UniqueName="EmployeeNumber" ItemStyle-Width="10%" ColumnValidationSettings-EnableRequiredFieldValidation="true">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true" EnableModelErrorMessageValidation="true">
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="*Required" Display="Static" SetFocusOnError="true">
                                </RequiredFieldValidator>
                                <ModelErrorMessage SetFocusOnError="true" />
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="OrganizationName" HeaderText="Organization" DataField="Organization" HeaderStyle-Width="10%">
                            <ItemTemplate>
                                <%#Eval("Organization") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadComboBox runat="server" ID="OrganizationRadComboBox" Width="100px">
                                </telerik:RadComboBox>
                                <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="OrganizationRadComboBox" runat="server" ErrorMessage="*Required" Display="Static"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridDateTimeColumn UniqueName="Date" PickerType="DatePicker" HeaderText="Date" HeaderStyle-Width="14%" DataField="TransactionDate" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" Text="*Required" Display="Static">
                                </RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridDateTimeColumn>
                        <telerik:GridDateTimeColumn UniqueName="Time" PickerType="TimePicker" HeaderText="Time" HeaderStyle-Width="14%" DataField="TransactionTime" DataType="System.DateTime" DataFormatString="{0:HH:MM}">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" Text="*Required" Display="Static">
                                </RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridDateTimeColumn>
                        <telerik:GridTemplateColumn UniqueName="Contact" HeaderText="Contact" HeaderStyle-Width="10%" DataField="Contact">
                            <ItemTemplate>
                                <%#Eval("Contact") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox runat="server" ID="radNumericTextBox" MinValue="0" NumberFormat-DecimalDigits="0" MaxValue="2147483647" Width="200px">
                                </telerik:RadNumericTextBox>
                                <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="radNumericTextBox" runat="server" ErrorMessage="*Required" Display="Static"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                         
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowKeyboardNavigation="true">
                    <%--<ClientEvents OnRowCreating="OnRowCreating" />--%>
                </ClientSettings>
            </telerik:RadGrid>

6 Answers, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 1
answered on 25 Feb 2016, 02:20 PM

Hi,

Please provide your inputs on this we are still facing this issue , we are waiting for your response.

Thank you.

 

 

 

0
Accepted
Maria Ilieva
Telerik team
answered on 26 Feb 2016, 12:33 PM
Hi,


I have examined the provided code snippet and everything seems correctly set.

Nevertheless, I have noticed that you are using .NET 4.5, where there are some problems with the standard validation controls. Generally, if you are using MS ScriptManager (instead of RadScriptManager), a server-side exception will be throws. RadScriptManager is handling that error internally, but without fixing the validation problems.

In order to get validators to work correctly with .NET 4.5 you will need to include the following line in your web.config file:
Copy Code
<appSettings>
  <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />

Please give this a try and let me know if the validations is working correctly after adding the above line.

I am looking forward to your reply.


Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rahul
Top achievements
Rank 1
answered on 03 Mar 2016, 10:42 AM

Hi Maria Ilieva,

Your suggestion works perfectly thank you very much.                                                                                                                                 I have small query can we customize textbox backColor  when it validation message is being displayed.PFA

Thanks,

 

0
Maria Ilieva
Telerik team
answered on 08 Mar 2016, 02:17 PM
Hi,

In order to change the edited cell background color you can modify the .rgBatchChanged class. For example
.rgBatchChanged
         {
             background-color:red;
         }
will change the background to red once a cell is edited.


Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rahul
Top achievements
Rank 1
answered on 09 Mar 2016, 12:25 PM

Hi Maria Ilieva,

Thanks for your replay, I don't want to change color of cell I want change color of control (like TextBox,Dropdownlist,or date picker) when the particular control left empty.

Please provide your thoughts if we can achieve expected behavior . thanks in advance.

 

0
Maria Ilieva
Telerik team
answered on 11 Mar 2016, 02:59 PM
Hello Rahul,

Unfortunately the required functionality is not supported out of the box and is available with custom css approach that is out of our support scope.

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or