我有两个grid,gridview1,gridview2我要将gridview1里面的选择行选中后,按个BUTTON后,将该行信息添加到gridview2并显示出来然后再按hutton后提交到数据库。由于里面有列是图片列,所以没有用list而用了gridview。不知道该怎么做,请指教。使用datatable新增行也可,谢谢啊。
解决方案 »
- 报表怎么传递参数啊
- window.onresize 的问题
- updatepanel???
- 關於打印很笨的問題,如何默認將頁面設置變為橫向
- ■■你们是如何调试vs2003的?每修改一次,然后按Ctrl+F5编译吗?
- 循环执行多条insert语句后,出现:ORA-01000: 超出打开游标的最大数
- 请提宝贵意见,言者有分。
- 如何复制一条相同的记录?我在ORACLE数据库中有一条记录,记录中有BLOB字段,我想重新复制这条带BOLB字段的记录,我该如何写SQL呢?
- 问:全文检索应该怎么做?
- 高分相送!!!!
- (原创)ADO.NET数据库优化超级技巧之程序池
- 给常写实体类的兄弟们一个自动生成小程序....高手就别进来了..
protected void ImageButton1_Click2(object sender, ImageClickEventArgs e)
{
DataTable dt=new DataTable();
dt.Columns.Add("Log29013");//这个是图片列,好像有问题
dt.Columns.Add("Log29001");
DataRow drw=dt.NewRow();
dt.Rows.Add(drw);this.GridView2.DataSource = dt;
this.GridView2.DataBind();}
dt.Columns.Add("Log29013");//这个是图片列,好像有问题
dt.Columns.Add("Log29001");
DataRow drw=dt.NewRow();
dt.Rows.Add(drw);楼主加了新行可是没有给新行的内容赋值啊当然是空的了
protected void ImageButton1_Click2(object sender, ImageClickEventArgs e)
{
DataTable dt = new DataTable("New"); DataRow dr = dt.NewRow(); dr[1] = this.GridView1.SelectedRow.Cells[1].Text;//这行是图片行,但是出错了
dr["Log29001"] = this.GridView1.SelectedRow.Cells[2].Text;//这样写好像也有问题,说dr里面没有该列... dt.Rows.Add(dr); this.GridView2.DataSource = dt;
this.GridView2.DataBind();
}怎么 写比较好呢?
table.Columns.Add("Log29013");//这个是图片列,好像有问题
table.Columns.Add("Log29001");
for(int i=0;i<dt.row.count;i++)
{
DataRow row = table.NewRow();
row["Log29013"]=dt.row[][].tostring();
row["Log29001"]=dt.row[][].tostring();
table.row.add(row);
}
{
DataTable dt = new DataTable("New"); dt.Columns.Add(new System.Data.DataColumn("Log29013",typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("Log29001", typeof(System.String))); DataRow dr = dt.NewRow(); dr[0] = this.GridView1.SelectedRow.Cells[1].Text;
dr[1] = this.GridView1.SelectedRow.Cells[2].Text; dt.Rows.Add(dr);
this.GridView2.DataSource = dt;
this.GridView2.DataBind();
}
然后在GridView1里面通过 ImageUrl='<%# Eval("Log29013") %>' 显示我使用dr[0] = this.GridView1.SelectedRow.Cells[1].Text; 图片只能显示XX我在考虑将增加一列隐藏的链接列
{
DataTable dt = new DataTable("New"); dt.Columns.Add(new System.Data.DataColumn("Log29013",typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("Log29001", typeof(System.String))); DataRow dr = dt.NewRow(); dr[0] = this.GridView1.DataKeys[this.GridView1.SelectedRow.RowIndex]["Log29013"].ToString();
dr[1] = this.GridView1.SelectedRow.Cells[2].Text; dt.Rows.Add(dr);
this.GridView2.DataSource = dt;
this.GridView2.DataBind();
}