GridView 和textbox的问题

二杠子 2009-04-26 11:46:23
我怎么样才能把GridView 的数据写到textbox中去
...全文
104 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lvsihan0327 2009-04-26
  • 打赏
  • 举报
回复
up
qiweihero 2009-04-26
  • 打赏
  • 举报
回复
能不能说的具体些??
是不是要取到某行某列里面的值开啊??
teerhu 2009-04-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 yangqidong 的回复:]
1.GridView1.Rows[行号].Cells[列号]单元格里面如果没有别的控件
textbox.Text = GridView1.Rows[行号].Cells[列号].Text;

2.GridView1.Rows[行号].Cells[列号]单元格里面如果有控件,比如Label则
textbox.Text = (GridView1.Rows[行号].Cells[列号].Controls[0] as Label).Text;
[/Quote]
支持
yangqidong 2009-04-26
  • 打赏
  • 举报
回复
1.GridView1.Rows[行号].Cells[列号]单元格里面如果没有别的控件
textbox.Text = GridView1.Rows[行号].Cells[列号].Text;

2.GridView1.Rows[行号].Cells[列号]单元格里面如果有控件,比如Label则
textbox.Text = (GridView1.Rows[行号].Cells[列号].Controls[0] as Label).Text;
软件搬运工 2009-04-26
  • 打赏
  • 举报
回复
1.GridView1.Rows[行号].Cells[列号]单元格里面如果没有别的控件
textbox.Text = GridView1.Rows[行号].Cells[列号].Text;

2.GridView1.Rows[行号].Cells[列号]单元格里面如果有控件,比如Label则
textbox.Text = (GridView1.Rows[行号].Cells[列号].Controls[0] as Label).Text;
不是很詳細嗎?

取數據當然先好取到某行,不然怎麼傳數據呢?
二杠子 2009-04-26
  • 打赏
  • 举报
回复
能不能详细点
急死人那 啊?!1
wuyq11 2009-04-26
  • 打赏
  • 举报
回复
在GridView1_RowCommand事件中获取当前行值,再遍历gridview赋值给相关单元格
二杠子 2009-04-26
  • 打赏
  • 举报
回复
就是我在GridView的编辑模块中放置以个checkBox后再就结束模块的编辑
仍后我选中第一行的gridview的数据再点我事先放好的linkbutton控件
它就可以把第一行第二列的数据传到textbox中并且显示出来
luoyisheng08 2009-04-26
  • 打赏
  • 举报
回复
对啊,你具体要问什么问题呢?
whowhen21 2009-04-26
  • 打赏
  • 举报
回复
楼上的有说清楚了哦~

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧