Ticket T596757
Visible to All Users

FormDataCollection Does not contain a parameterless constructor

created 7 years ago

For what ever reason, the data is not binding from the grid to the post events.

The actions are being called. the data is blank. (I have added a parameterless constructor to see if that helped)

However, data is being sent from the client. So my guess is it is to do with binding.

I was copying the demo here:
https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/FormEditing/Mvc/Light/

Except I am using a controller rather than API Controller.

So on delete :

sending FormData: key:
73

method returns internal error, parameterless constructor doesnt exist. With added constructor, form/key is empty.

C#
[HttpDelete] public void ConditionsDelete( FormDataCollection form) { var rec_no = Convert.ToInt32(form.Get("key")); }

My grid is using

C#
.DataSource(d => d.Mvc().Controller("Settings") .LoadAction("ConditionsList") .UpdateAction("ConditionsUpdate") .InsertAction("ConditionsAdd") .DeleteAction("ConditionsDelete") .Key("rec_no") )

Is there something extra i need to do? It all seems like it should be working

Comments (1)

    Switching to API controller seems to have fixed the binding issue, though not sure why, you have the d.Mvc() option.
    It is probably better going forward swapping to API controller anyway. But my main grid i have to use controller as it requires session data.
    Fortunately i dont require to add/save/delete from the main grid. But curious incase it comes up, how to get it working on a controller.

    Answers approved by DevExpress Support

    created 7 years ago (modified 7 years ago)

    Hi,

    The Delete action implementation should be much simpler because it requires only the key parameter of the target record:

    C#
    [HttpDelete] public void ConditionsDelete(int key) { var rec_no = Convert.ToInt32(key); ... }

    Attached is a standalone code example. I hope this information helps.

    Thanks,
    Alessandro

      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.