简体   繁体   English

按下“提交”按钮时未保存Telerik Grid Client模板数据

[英]Telerik Grid Client template data not saved while Submit button press

I am using telerik controls in my project when i am using client template for a column but the data appears in client template not saving while submit button press, it is showing empty template. 当我在使用客户端模板作为列时,在项目中使用Telerik控件,但是在提交按钮按下时,客户端模板中的数据没有保存,它显示了空模板。 Below is my code 下面是我的代码

@(Html.Telerik().Grid<edairy.Models.ReceiptsEntry.mst_stock_dtl>()
    .Name("gdStkDetails")
            .ToolBar(commands =>{ commands.Insert();
               commands.SubmitChanges();
            } )


           .DataKeys(keys => keys.Add(c => c.Trans_No))
             .Pageable(paging =>
                    paging.PageSize(10)
                          .Style(GridPagerStyles.NextPreviousAndNumeric)
                          .Position(GridPagerPosition.Bottom))
                          .Sortable(sorting => sorting
                          .SortMode(GridSortMode.MultipleColumn))
                                  .ClientEvents(e => e.OnDataBound("onDataBound"))

                          .DataBinding(databing => databing.Ajax()
                                                           .Select("SelectStock", "ReceiptsEntry")
                                                           //.Insert("AddStock", "ReceiptsEntry")
                                                           .Update("Editproduct", "ReceiptsEntry")
                                                           //.Delete("DeleteStock", "ReceiptsEntry")
                                                           )


           .Columns(columns =>
            {
               columns.Bound(c => c.Trans_No).Title("Transaction No").Width(100);
               columns.Bound(c => c.Product_cd).Title("Product Code").EditorTemplateName("GrdDropdown").Width(150);
               columns.Bound(c => c.Prouduc_desc).Title("Product Desc").EditorTemplateName("text").Width(100);
               columns.Bound(c => c.Prouduc_desc).Title("Product Desc").ClientTemplate("<input type='text' id='text' name='ProductDesc' /> ").Width(100);
               columns.Bound(c => c.Receipt_Quantity).Title("Receipt Qty").Width(150);
            columns.Command(commands =>
            {
           // commands.Edit();
            commands.Delete();
              });
            })

            .Editable(editing => editing.Mode(GridEditMode.InCell))
            //.Editable(editing => editing.Mode(GridEditMode.PopUp))

                )

                </text>);
        })
        .SelectedIndex(0)
        .Render();
} 

kindly help me in this issue.Thanks in advance. 请在这个问题上为我提供帮助。

Trying change your action to something like this: 尝试将操作更改为以下内容:

[AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
public ActionResult Editproduct([Bind(Prefix = "updated")]IEnumerable<edairy.Models.ReceiptsEntry.mst_stock_dtl> data)

Be, carefully when you change the data on the grid you need to be sure the focus leave the textbox, because the grid needs to know the value on the textbox was changed.. try it. 是的,当您更改网格上的数据时,请务必确保焦点离开文本框,因为网格需要知道文本框上的值已更改。

hope this, help. 希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM