数据库和GridView [英] database and gridview

查看:57
本文介绍了数据库和GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用网格视图中的数据馈送.我使用复选框以选择每行数据,如果选中一个复选框中的数据应该被选择,当我应该点击底部拍摄的按钮,从该行的数据应该从GridView控件移动到anoder GridView的.

gridview 1绑定到名为customer的数据库表,而Gridview 2绑定到customer_copy表.

但是数据不能正常移动...

我已经在Visual Studio中编写了代码,我非常担心,因为这阻止了我的项目完成.

pls帮助

问候,

Taresh

Hi,

I am using a gridview in which data is fed. I am using checkboxes to select data on every row, when a checkbox is checked the data should be selected and when i should click on the button taken at the bottom the data from that row should move from that gridview to anoder gridview .

the gridview 1 is bounded to to database''s table called customer and the gridview 2 is bounded to table customer_copy.

however the data is not moving properly...

I have written the code in visual studio and I m pretty worried as this is stopping my project to get completed.

pls help

regards,

Taresh

推荐答案

你好,

您说:当我单击底部的按钮时,该行中的数据应从该网格视图移动到阳极网格视图"
而且:"gridview 2绑定到表customer_copy"

您没有发布代码,但我想您想将数据直接从grid1移到grid2.
为什么在单击按钮后不尝试更新customer_copy表?
Hello,

you said: "When i should click on the button taken at the bottom the data from that row should move from that gridview to anoder gridview"
And Also: "gridview 2 is bounded to table customer_copy"

You didn''t post the code but I think you want to move the data from grid1 to grid2 directly.
Why don''t you attempt to update the customer_copy table after clicking on the button?


//your datatable (all)
            DataTable dtAll = getTable();

            //your new datatable (only selected)
            DataTable dtSelected = dtAll.Clone();

            //save data
            //Save using  Grid
            foreach (GridViewRow rw in grid1.Rows)
            {
                //copy updated data
                if (((CheckBox)rw.Cells[0].FindControl("uxIncludeckbox")).Checked == true)
                {
                    dtSelected.Rows.Add(dtAll.Rows[rw.RowIndex]);
                }
            }
//Now dtSelected is Selected Datatable
//Bind it to another grid


这篇关于数据库和GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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