我想检查一些行,如果我单击“批准"按钮,则应使用实体框架将检查的行插入表中. [英] I want to check some rows and if I click on approve button checked rows should insert in table using entity framework.

查看:77
本文介绍了我想检查一些行,如果我单击“批准"按钮,则应使用实体框架将检查的行插入表中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有gridview列(id,Empid,EmpName,BalanceLeaves,leaveid,From,To,Days,Reason,Supervisor,Address,ContactNo,应用备注).

我在gridview的每一行都有复选框.
我想检查一些行,如果我单击批准"按钮,则应使用实体框架将检查的行插入表中.

请给出一些想法.

I have gridview columns (id, Empid, EmpName, BalanceLeaves, leaveid, From, To, Days, Reason, Supervisor, Address, ContactNo, Applied remarks).

I have checkboxes in every row of gridview.
I want to check some rows and if I click on approve button checked rows should insert in table using entity framework.

Please give some idea.

推荐答案

不要使用"foreach"循环,即简单易行的逻辑循环遍历每一行,并选中该复选框(模板列),如果选中该复选框,则会初始化实体并将其添加到实体的List对象,最后使用实体框架的实体服务直接保存集合对象.

希望对您有帮助.
Don''t you want to use a "foreach" loop, the simple and easy logic looping through each row, checking against the checkbox (template column) and if checked initialize the entity and add it to List object of the entity, finally using entity frameworks entity service save the collection object directly.

hope this helps you.


这篇关于我想检查一些行,如果我单击“批准"按钮,则应使用实体框架将检查的行插入表中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆