Using Upload inside Grid

2 posts, 0 answers
  1. Kord
    Kord avatar
    2 posts
    Member since:
    Apr 2018

    Posted 25 Nov 2018 Link to this post

    There is my table:

    public class Sound
        public Guid GUID { get; set; }
        [Display(Name = "Sound Type")]
        public SoundType SoundType { get; set; }
        [Display(Name = "Bandwidth, kHz")]
        public byte? Bandwidth { get; set; }
        [Display(Name= "Frequency, Hz")]
        public short? Frequency { get; set; }
        [Display(Name = "Duration, ms")]
        public short? Duration { get; set; }
        [Display(Name="Sound File")]
        public byte[] Content { get; set; }
        [Display(Name = "File Name")]
        public string FileName { get; set; }
        public Sound()
            GUID = Guid.NewGuid();


    I just would like to show it in a grid and to be possible to upload files into the Content field and to store their names in the FileName field.

    I've been trying to find out some examples of how to perform this, but almost all of them use separated steps to upload files into some directory on the server and to save the path to the file in the table then. I prefer to save the file attributes and its content as one step using Create or Update method of SoundsController.

    Is it possible to do it this way? Are there some examples?

    Thank you.

  2. Marin Bratanov
    Marin Bratanov avatar
    4761 posts

    Posted 26 Nov 2018 Link to this post


    If you have a separate view for the editor (e.g., in a custom popup template), you can have an upload there and store all fields in the same POST request. See how to use the uploaded file as a part of the form POST here: and you can extend the form to contain the rest of the inputs from the model.

    You can find another example in the following code library entry:

    If you will be using any sort of asyncronous file uploads, however, you'd need to store the file and its name somewhere on the server before the actual grid item edit happens, simply because that's an asyncronous operation. You can see how to add metadata to the uploads here so you can take the user ID from the client and send it together wit the file so you can immediately update the data source:

    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top