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
180
ig_transactions is null when delete row
posted

I use Dapper and  bind grid with datatable like this

[controller]

ds = SqlHelper.ExecuteDataset(cn, CommandType.Text, "select id,fullname from tbl_profile_users");
            
return View("~/Views/user/all.cshtml", ds.Tables[0]);

[view]

 @(Html.Infragistics().Grid ()
        .ID("grid1")
        .Width("100%")
        .AutoGenerateColumns(false)
        .AutoGenerateLayouts(true)
        .RenderCheckboxes(true)        
        .PrimaryKey("id")
        .Columns(column => {

                           
                            column.For(x => x.id).HeaderText("id").Width("150px");
                            column.For(x => x.fullname).HeaderText("Fullname").Width("150px");                          
                            }
                )
                            
        
        .Features(features =>            
        {
            
            features.Paging().PageSize(5).Type(OpType.Remote).Inherit(false);
            features.Selection().Mode(SelectionMode.Row).MultipleSelection(true);
            features.Hiding().Inherit(true);
            features.Filtering();
            features.Updating().EnableDeleteRow(true);
            features.Updating().EnableAddRow(false);
            
            
        })
        .DataSource(Model)
        .DataSourceUrl(Url.Action("all_profiles"))
        .UpdateUrl(Url.Action("save_profile/"))
        .DataBind()
        .Render()
    )       

[script ]

   //
        $(function () {

            
            $("#grid1").on("iggridupdatingrowdeleting", function (e, args) {
                $("#grid1").igGrid("saveChanges");                              
            });
        });
// ]]> //
        $(function () {

            
            $("#grid1").on("iggridupdatingrowdeleting", function (e, args) {
                $("#grid1").igGrid("saveChanges");                              
            });
        });
// ]]>

but when delete rows I just get only null ig_transactions,also I Add Watch HttpContext.Request.Form["ig_transactions"] but not have anything value

Parents
  • 29417
    Offline posted

    Hello quang tran, 

    Thank you for posting in our forum. 

    Are there any errors thrown on the page when you attempt to delete a row?

    You can check this by opening your browser’s  developer tools (using F12) and checking the Console for any errors.
    It’s possible that an errors is thrown due to an incorrect PrimaryKey since in your code snippet the primary key:

    .PrimaryKey("MaSoBaoDanh")

    does not match any of the columns specified for the grid:

      .Columns(column => {

                               
                                column.For(x => x.id).HeaderText("id").Width("150px");
                                column.For(x => x.fullname).HeaderText("Fullname").Width("150px");                          
                                }
                    ) 

    Updating requires the PrimaryKey to be set to an existing column in your data source, whose values will serve as an unique identifier for the records in the grid. If the primary key is not set or is not a valid column updating operations (updating, deleting, adding rows) will fail. 

    I suggest you set the primary key to an existing column, for example:

    .PrimaryKey("id") 

    Let me know if you have any additional questions or concerns. 

    Best Regards,

    Maya Kirova

    Infragistics, Inc.

    http://es.infragistics.com/support

     

     

Reply Children
No Data