EasyUI Forum
September 14, 2025, 12:22:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Can I use FormCollection to get the DataGrid's row in controller's action?  (Read 7178 times)
kissmoon
Newbie
*
Posts: 25


View Profile
« on: January 06, 2015, 10:45:43 PM »

In C#, MVC。
There is a [HttpPost] Controller's Action, define FormCollection to get the values of form 。
when the view submit,can not get values.

controller's action
Code:
[HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create(FormCollection s)
        {
            string sd = s.ToString();
           
            return View();
        }

Create.cshtml code
Code:
 $("#bomdg").datagrid({
        toolbar: '#tb',
        singleSelect: true,
        onClickRow: onClickRow,
        columns: [[
            {
                title: 'material',
                field: 'pdm_bomdetail_tb_id_part',
                width: 180,
                formatter: function (value, row) {
                    return row.name;
                },
                editor: {
                    type: 'combobox',
                    options: {
                        valueField: 'id',
                        textField: 'name',
                        method: 'get',
                        url: '/Bom/GetPartData',
                        required: true,
                        missingMessage: 'request',
                        onSelect: function (value) {
                            var row = $("#bomdg").datagrid('getSelected');
                            var rindex = $("#bomdg").datagrid('getRowIndex', row);
                            bomver = $('#bomdg').datagrid('getEditor', { index: rindex, field: 'pdm_bomdetail_tb_id_part_bom' });
                            if (value.id == '') return;
                           
                            $.getJSON('/Bom/GetPartBom', { partid: value.id }, function (data) {
                                bomver.target.combobox('loadData', data);
                                bomver.target.combobox("setValue", "");
                                edv = $('#bomdg').datagrid('getEditor', { index: rindex, field: 'bom_version' });
                                $(edv.target).textbox('setValue', "");
                            });
                           
                            $.getJSON('/Bom/GetSinglePart', { partid: value.id }, function (data) {
                                var edc = $('#bomdg').datagrid('getEditor', { index: rindex, field: 'part_code' });
                                $(edc.target).textbox('setValue', data[0].code);

                                var edn = $('#bomdg').datagrid('getEditor', { index: rindex, field: 'part_name' });
                                $(edn.target).textbox('setValue', data[0].name);
                            });
                        }
                    }
                }
            },
            {
                title: 'material_code',
                field: 'part_code',
                width: 80,
                editor: {
                    type: 'textbox',
                    options: {
                        readonly: true
                    }
                }
            },
            {
                title: 'material_name',
                field: 'part_name',
                width: 180,
                editor: {
                    type: 'textbox',
                    options: {
                        readonly: true
                    }
                }
            },
            {
                title: 'BOM_code',
                field: 'pdm_bomdetail_tb_id_part_bom',
                width: 120,
                formatter: function (value, row) {
                    return row.bomname;
                },
                editor: {
                    type: 'combobox',
                    options: {
                        valueField: 'id',
                        textField: 'name',
                        data: databom,
                        onSelect: function (value) {
                            var row = $("#bomdg").datagrid('getSelected');
                            var rindex = $("#bomdg").datagrid('getRowIndex', row);
                            if (value.id == '') return;
                           
                            $.getJSON('/Bom/GetBomVersion', { bomid: value.id }, function (data) {
                                var edc = $('#bomdg').datagrid('getEditor', { index: rindex, field: 'bom_version' });
                                $(edc.target).textbox('setValue', data[0].code);
                            });
                        }
                    }
                }
            },
            {
                title: 'BOM Version',
                field: 'bom_version',
                width: 80,
                editor: {
                    type: 'textbox',
                    options: {
                        readonly: true
                    }
                }
            },
            {
                title: 'qty',
                field: 'pdm_bomdetail_tb_qty',
                width: 80,
                editor: {
                    type: 'numberbox', options: { precision: 4, min: 0, required: true, missingMessage: 'request' }
                }
            }
        ]]
    });
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!