Required Field Validator for RadAsyncUpload

1 Answer 20 Views
AsyncUpload Grid
Jonathan
Top achievements
Rank 1
Jonathan asked on 01 Oct 2021, 08:32 PM | edited on 01 Oct 2021, 08:39 PM

Hello,

I have a RadGrid with a custom EditForm that I use to insert new items.  Within this form is a RadAsyncUpload control.  How do I make this control required without server side code?

Also, I'm a beginner with Telerik and have seen countless code snippets online.  None of them address having the control inside an EditForm, so if your solution could show a complete example vs code snippet I would appreciate it.

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 06 Oct 2021, 01:16 PM

Hi Jonathan,

Concerning validation in RadGrid edit form, I would suggest you check out the Adding a validator to EditItemTemplate of GridTemplateColumn section.

As to the client-side validation for AsyncUpload, If you are using .NET 4.5+ you can set the following key in the web.config to enable the client-side validation that would prevent the postback without an attached file:

http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery

I hope this will help you achieve the desired.

Please let me know if any questions remain.

Kind regards,
Doncho
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Jonathan
Top achievements
Rank 1
commented on 14 Oct 2021, 04:51 PM

Unfortunately this doesn't work.  When I launch the page and click on the insert button, the rest of my field validators fire but this does not.
Jonathan
Top achievements
Rank 1
commented on 15 Oct 2021, 09:48 PM

I've made so many changes trying to get this work, but I am finally getting the javascript function to fire and have implemented a try catch block to trap the errors.  Now getting an error - "Cannot read properties of null (reading 'getUploadedFiles')".

 

Any ideas?

Doncho
Telerik team
commented on 19 Oct 2021, 08:25 AM

Jonathan, 

I have attached a basic RadGrid sample where you can test the suggested validation. Please review the code and see if you can reuse it in your case.

Note that the sample aims to demonstrate the client-side validation only, and the Inserting is not actually implemented in the grid.

If this is not useful, it would be a great help if you share the steps to replicate the same problem with the sample I have shared.

Tags
AsyncUpload Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Doncho
Telerik team
Share this question
or