Rad Grid Batch Editing Validation not working

7 posts, 1 answers
  1. Rahul
    Rahul avatar
    27 posts
    Member since:
    Jul 2015

    Posted 23 Feb Link to this post

    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>
  2. Rahul
    Rahul avatar
    27 posts
    Member since:
    Jul 2015

    Posted 25 Feb Link to this post

    Hi,

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

    Thank you.

     

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 26 Feb Link to this post

    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
  5. Rahul
    Rahul avatar
    27 posts
    Member since:
    Jul 2015

    Posted 03 Mar in reply to Maria Ilieva Link to this post

    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,

     

  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Mar Link to this post

    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
  7. Rahul
    Rahul avatar
    27 posts
    Member since:
    Jul 2015

    Posted 09 Mar in reply to Maria Ilieva Link to this post

    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.

     

  8. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Mar Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017