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

RadGrid Batch row mode Validation problem

4 Answers 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 04 Aug 2016, 03:48 PM

When I click "add new row", required field validation raises exceptions/constraints one cell at a time. i.e. not allowing the rows data to be entered in any other order / or for the entire row to appear in edit mode.

behavior reproducible on BatchEditing demo page: http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

It seems like I would have noticed this before, so maybe it's update related: I have a RadGrid that has Batch Edit row mode enabled.

Is that intended? Can it be changed with an attribute? if not, how about some client side js? I'll be debugging, but would appreciate an available solution.

 

Thanks

 

 

4 Answers, 1 is accepted

Sort by
0
Kyle
Top achievements
Rank 1
answered on 04 Aug 2016, 06:47 PM

Found "solution" by JavaScript debugging. combination of js errors from GridTemplateColumn:DefaultInsertValue not yet being options in dropdown lists(unhandled js exceptions on adding row in Telerik.Web.UI.WebResource.axd) and ColumnValidationSettings attr: RenderValidatorBeforeEditor="false".

0
Maria Ilieva
Telerik team
answered on 09 Aug 2016, 12:21 PM
Hello,

The solution you found is proper one and can be used in your scenario.
Also I am attaching a simple example demonstrating such client-side validation, where you could go through each row, get reference to any of the cells of that row and validate each value. This should be achieved in the client-side OnCommand event of the grid. If the validation fails for any row you could cancel the command, which will prevent the postback.

Regards,
Maria Ilieva
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Srinivas
Top achievements
Rank 1
answered on 06 Mar 2019, 02:05 PM

Hi Maria,

I am also having same issue on Batch Editing Row Mode the required field validator not working. I have created a ticket # 1398754. Can you please look into the provide a solution. I try to implement your similar using your example code but it is showing back ground back color if I click on Grid's Save Changes but I am looking to fire required fields on external button Save and Grid's delete is not working.

Regards,

Srinivas 

0
Attila Antal
Telerik team
answered on 11 Mar 2019, 07:29 AM
Hi Srinivas,

You can use any control outside of the Grid to make it save the changes by following the instructions from Batch Editing Client-side API article, and once you have added the the ValidationSettings key to the Web.config, the RequiredFieldValidator will validate the controls that do not have a valid value. 

<appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>

To change the background or text color of the Error message that appears from the RequiredFieldValidator, you can use the BackColor and ForeColor properties of this control: 

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" BackColor="Teal" ForeColor="LimeGreen"  ErrorMessage="* This field is required">
</asp:RequiredFieldValidator>


Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Kyle
Top achievements
Rank 1
Answers by
Kyle
Top achievements
Rank 1
Maria Ilieva
Telerik team
Srinivas
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or