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

[Solved] Validate UploadControl

1 Answer 161 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Datamex
Top achievements
Rank 2
Datamex asked on 29 Mar 2011, 09:13 PM
Hello,

I was wondering how to properly validate the upload control for MVC. I cannot bind the control to a property as far as I know? So I cannot use the model validation since the icon property of my entity won't be set when the model hits the controller. So I can validate server side and post back a message to the validation summary, but I'd rather check it client side and set an error message before anything is being posted back onto the server. Is this possible?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 30 Mar 2011, 11:54 AM
Hi,

I'm not sure if model validation is a good fit for the Upload, at least not in the asynchronous upload mode. But client validation is certainly an option that can improve the user experience.

We've prepared a Code Library entry that demonstrates how to use jQuery Validate to ensure that at least one file is uploaded. The project covers both sync and async modes. The full source code is available here - Upload client-side validation

Regards,
Tsvetomir Tsonev
the Telerik team
Tags
Upload
Asked by
Datamex
Top achievements
Rank 2
Answers by
T. Tsonev
Telerik team
Share this question
or