怎么把Listview的值传到DataGridView里面

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么把Listview的值传到DataGridView里面相关的知识,希望对你有一定的参考价值。

我要做一个酒水消费的.商品显示和分类我用的树结构.从数据库导出的..然后显示在listview里面了. 但我现在还要做个消费单.在listview里双击事件然后导到datagridview里面. 怎么写吖..?各位大虾帮帮忙.
或者可以把消费单也做成listview吗.? 请指教

参考技术A 给你说一种比较复杂点的做法。
1、用reflection技术将数据库数据一次读出,包含分类的商品及消费单,包含在泛型类中List<>;
2、在构建酒水树结构的时候,把listview的treenode.tag和具体的list[]关联
3、当你双击的时候就可以把treenode.tag导出到任何地方,包括datagridview或者其他显示控件中。
不过比较复杂哈
参考技术B 在listview里取到主键值,再另外写语句填到dataset里并将其做数据源就OK了。 参考技术C 可以动态写DATASET 然后和DATAGRIDVIEW绑定本回答被提问者采纳

Jquery easyui 怎么得到datagrid 里面的值和传到后台

参考技术A 您好:得到datagrid的数据有好几种。
getData() Return the loaded data.
getRows() Return the current page rows.
getFooterRows() Return the footer rows.
getRowIndex() Return the specified row index, the row parameter can be a row record or an id field value.
getChecked() Return all rows where the checkbox has been checked. This method is available since version 1.3.
getSelected() Return the first selected row record or null.
getSelections() Return all selected rows, when no record selected, am empty array will return.
传到后台的话直接ajax提交即可。本回答被提问者和网友采纳

以上是关于怎么把Listview的值传到DataGridView里面的主要内容,如果未能解决你的问题,请参考以下文章

怎么把action中的值传到jsp页面

怎么把一个窗体中的值传到另一个窗体中的textbox中

做winform里怎么把登陆页面的账号传到其他页面的控件中

请问哪位高手知道怎么把一个数值从ASPX页里传到HTML页里呢,

listview中每个item都有一个edittext,怎么把用户输入edittext的值保存到数据库?

怎么把cas登录页面的参数 传到 casservicevalidationsuccess,jsp