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

Validation in Grid pop-up

2 Answers 692 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Veteran
Martin asked on 15 Apr 2021, 09:23 AM

First a salute to the Telerik team. The Grid is awesome, thanks for making me look like a rock star.

I am using the build in Blazor FileUpload component, not Telerik and would like to show validations errors in the pop-up form for not supported file types.

How can I show errors in a component like the Validation Summary?

 

2 Answers, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 1
Veteran
answered on 15 Apr 2021, 04:43 PM

Unable to edit my post, so I add some more content here.

Is there a way to add content to the Validation Summary control? Can I access it in code?

 

 

0
Marin Bratanov
Telerik team
answered on 16 Apr 2021, 04:03 PM

Thank you, Martin! I'm happy to see our components put to good use!

On the file validation - this post will send you down a rabbit hole because you will have to delve deep into the way validation works in Blazor. Since there is none built-in validation for files in the framework, one has to roll out their own, and that's not super easy.

You can start from the following sample to see one way you could implement validation for files: https://github.com/telerik/blazor-ui/tree/master/upload/form-validation

If you can't put all the necessary code in an editor template, I would suggest you create a custom edit form: https://github.com/telerik/blazor-ui/tree/master/grid/custom-popup-form

Programmatic access to components isn't really a thing in Blazor, at least for the purpose of modifying data, to affect the validation one usually goes through the edit context and its validation message store. You can read more about these things in the MSDN documentation, there is quite a lot to unpack: https://docs.microsoft.com/en-us/aspnet/core/blazor/forms-validation?view=aspnetcore-5.0.

Regards,
Marin Bratanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Veteran
Answers by
Martin
Top achievements
Rank 1
Veteran
Marin Bratanov
Telerik team
Share this question
or