Ticket S37054
Visible to All Users

Support model binding for UploadControl and HtmlEditor

Answers approved by DevExpress Support

created 12 years ago (modified 11 years ago)

We have implemented the functionality described in this ticket. It will be included in our next update(s).

Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

Additional information:

Now, the HtmlEditor and UploadControl MVC Extensions support model binding via the DevExpressEditorsBinder class.
UploadControl:
It is necessary to define the IEnumerable<UploadedFile> parameter whose name equals UploadControlSettings.Name in order to bind the selected files via the standard Model Binding mechanism:

C#
@using(Html.BeginForm("MultiFileSelection", "UploadControl")) { @Html.DevExpress().UploadControl(settings => { settings.Name = "ucMultiSelection"; }).GetHtml() ... }
C#
public ActionResult MultiSelectionImageUpload(IEnumerable<UploadedFile> ucMultiSelection) { return null; }

Take a look at the online Multi-File Selection demo to see this approach in action.

    Comments (3)

      Hi,
      can you please write a very small piece of code how to bind model's property to UploadControl?
      Thanks a lot!
      Marek

        Hello,
        It is necessary to define the IEnumerable<UploadedFile> parameter whose name equals UploadControlSettings.Name in order to bind the selected files via the standard Model Binding mechanism:

        C#
        @using(Html.BeginForm("MultiFileSelection", "UploadControl")) { @Html.DevExpress().UploadControl(settings => { settings.Name = "ucMultiSelection"; }).GetHtml() ... }
        C#
        public ActionResult MultiSelectionImageUpload(IEnumerable<UploadedFile> ucMultiSelection) { return null; }

        Take a look at the online Multi-File Selection demo to see this approach in action.
        If you need further assistance, please create a new ticket in our Support Center and describe your scenario in greater detail.

          Thanks a lot!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.