ActionResult (dataprocessor)

I’m trying to get the sample (dhtmlx.com/blog/?p=1349) work, but after adjusting it to my project, I’m facing the following errors:

grid.setColumnIds("a,b");//!added
grid.setInitWidths("*,100");
grid.setSkin("dhx_terrace");
grid.init();

grid.load(“@Url.Content(”~/Home/News")" + “?=” + grid.uid());
dp = new dataProcessor(“/Home/SaveNews”);//!added
dp.setTransactionMode(“POST”, false);
dp.enableDataNames(true);
dp.init(grid);

the gris is filled with data properly, but when I try to change a row, my ActionResult “SaveNews” gets the following data:

    public ActionResult SaveNews(customer changedCustomer, FormCollection form)
    {
        string action_type = form["!nativeeditor_status"]; //123_!nativeeditor_status
        long source_id = 10997;// long.Parse(form["gr_id"]); //123_gr_id
        long target_id = 10997; // long.Parse(form["gr_id"]); //123_gr_id
   ...
   }

object customer is empty and the name of the fields in the FormCollection always thart with the edited row-id, followed by “_”. Is that a normal behaviour? The only thing I changed was to adapt the aspx → cshtml:
@{
Layout = null;
Response.ContentType = “text/xml”;
}
@model SMP.Controllers.ActionResponseModel


should mean:

public ActionResult SaveNews(customer changedCustomer, FormCollection form)
{
string action_type = form["!nativeeditor_status"]; //123_!nativeeditor_status
long source_id = long.Parse(form[“gr_id”]); //123_gr_id
long target_id = long.Parse(form[“gr_id”]); //123_gr_id

}

so gr_id can’t be found, why I get an exception. I am using MVC and don’t want to use the .NET connector. Is there a way to get it work?

Hello,
your code should work correctly, please make sure that following line is executed dp.setTransactionMode("POST", false); and there is no more .setTransactionMode calls in your code.

object customer is empty and the name of the fields in the FormCollection always thart with the
edited row-id, followed by “_”. Is that a normal behaviour?
This behavior allows sending multiple updates within a single request. However it should be disabled by passing false as the second argument of .setTransaction mode

Check the attached project, maybe it will help
DHTMLXGrid_Razor.zip (357 KB)

Hi,

thanks for the example - now I found the reason. I am also using the ASP Scheduler.NET (it seems to be using another dataprocessor) - thought it is a good idea to use this component; do you recommend to use the “normal” scheduler? Or is it possible to deactivate the transaction mode in scheduler.net?

this mode is disabled by default, you can check any example from the /Samples package. Can you attach a demo that demonstrates the problem?