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

The ValidatingFile event is not fired under Microsoft MVC

1 Answer 59 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Lev
Top achievements
Rank 1
Lev asked on 20 Jun 2010, 10:28 AM
Hi All,

I am porting an ASP.NET application, which uses many Telerik AJAX controls including RadUpload, to the Microsoft MVC platform.
In general, after sweating a bit RadUpload is configured and functions as expected with one minor exception:
The legacy code runs its own validation within an event handler upon a server-side ValidatingFile event. However, under MVC this event is never fired. From your blog published more than a year ago I learnt why the old mechanism would not work; also that blog promised in future "a full-blown ASP.NET MVC application built on top of RadControls for ASP.NET Ajax".

So my questions are:
  • Does such application exist nowadays and is the server-side validation issue resolved in it? By the server-side validation I refer to validation that would be executed before the corresponding View is destroyed and execution flow is back within the Controller.
  • If I executed client-side validation in javascript, would such javascript code be able to validate the size of a selected file?
  • If the integrated validation used, would be there a way to provide custom error messages on validation failure?

Thank you in advance for your assistance.

-- Best regards

1 Answer, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 23 Jun 2010, 02:15 PM
Hello Lev,

Server side events do not fire in MVC. The eventhandling of webforms should not be used in MVC.

1) Such application exists and can be found here. It shows how to apply validation to the uploaded files. The related code is in the UploadAvatar action in the AccountController.  Unfortunately you cannot  use the RadUpload's integrated validation mechanisms since they rely on the Postbacks and event handling and this is strictly webforms area.

2) It is possible to apply extension/file size validation on the client. You can find more information here and here.

3) Unfortunately the integrated validation cannot be used. You can redirect to an Error view if your custom server validation fails.

Greetings,
Genady Sergeev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Upload (Obsolete)
Asked by
Lev
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or