The ValidatingFile event is not fired under Microsoft MVC

Thread is closed for posting
2 posts, 1 answers
  1. Lev
    Lev avatar
    6 posts
    Member since:
    Jun 2010

    Posted 20 Jun 2010 Link to this post

    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
  2. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Jun 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top