Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
igGrid datasource edit
posted

I am try to do this :
I want to extract the edited grid data when submit form in action method (below)

  [HttpPost]
    public ActionResult Index(Home_MVD h)
    {
        if (ModelState.IsValid)
        {
        }

        return View(h);
    }

Mvc_Ignite_test.rar  NOT INCLUDE packages  folder ,you can download from  'Manage NuGet packages'

thanks in advance...

Mvc_Ignite_test.rar
Parents
  • 18204
    Suggested Answer
    Offline posted

    Hello ticho ticho,

    Thank you for posting in our forums!

    In order to get the igGrid's edits during a post action, you will need to get the igGrid's transactions and set up a field in the form.  When the submit action occurs, you can set the transactions to the field's value.  Then, during your post action in the controller you can get the serialized data from the form.

    See below the following code changes I have made to your sample that are needed to allow this.  If you need further assistance, please let me know and I will be glad to help.

    In view markup:

    @using (Html.BeginForm())
    {
        @Html.Hidden("gridTransactions")
        ...

    In java script:

    $(function () {
        $("form").submit(function () {
            var transactions = JSON.stringify($("#grid").igGrid("allTransactions"));
            $("#gridTransactions").val(transactions);
        });
    });

    In controller action:

    String trans = HttpContext.Request.Form["gridTransactions"];

Reply Children
No Data