在同一页面中对gridView进行修改? 有一个gridView、一个修改按钮、三个文本框,选中gridView后,再点击修改,gridView中选中的那一行的内容就填充到三个文本框中去了。若gridView只可以选中一行该怎么做,若若gridView可以选中两行又该怎么做?补充:gridView中的标头分别为:姓名、性别、年龄。若是有代码就更好了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CellClickprivate void DataGridview1_CellClick(object sender, DataGridViewCellEventArgs e) { int count = this.DataGridview1.Rows.Count; if (count != 0) { id = Convert.ToInt32(this.DataGridview1[0, DataGridview1.CurrentCell.RowIndex].Value); txtxm.text = this.DataGridview1[1, DataGridview1.CurrentCell.RowIndex].Value.ToString(); txtsex.Text = this.DataGridview1[2, DataGridview1.CurrentCell.RowIndex].Value.ToString(); txtold.Text = this.DataGridview1[3, } } gridView点击事件 { this.姓名文本框.Text = this.gridView.SelectedItems[0].subItem[0].text; this.性别文本框.Text =this.gridView.SelectedItems[0].subItem[1].Text; this.年龄文本框.text = this.gridView.SelsectedItems[0].subItem[2].text;} 要注意subItem[n] n的值 DataGridView 和 GridView 好像有点不一样 你们说的是窗体应用程序中的DataGridView,我要的是asp.net中的GridView修改的做法。 如果是asp.netGridView里面可以添加一个Select列,里面就有一个Select按钮,在那个事件里面就可以根据e.RowIndex来获取当前行里面的数据. 邮箱发送问题 C#如何获取任务管理器中应用程序列表名称 如何根据IP得到字节序 ? 网络的或者主机的都可以 谢谢 有做过聊天系统的朋友进来帮个忙,项目急~~~~~~~~~~~~~~ 请教各位高手如何把一段字符串原样的写到数据库的varbinary类型的字段中 求打印代码 你们猜结果怎样? 请问怎样在菜单中加上图标??? C# 程序设计登录窗体 使用 Web browser时遇到此问题... 求助! c#使用正则,表达式是或关系,怎么获取起作用的匹配项?
private void DataGridview1_CellClick(object sender, DataGridViewCellEventArgs e)
{
int count = this.DataGridview1.Rows.Count;
if (count != 0)
{
id = Convert.ToInt32(this.DataGridview1[0, DataGridview1.CurrentCell.RowIndex].Value);
txtxm.text = this.DataGridview1[1, DataGridview1.CurrentCell.RowIndex].Value.ToString();
txtsex.Text = this.DataGridview1[2, DataGridview1.CurrentCell.RowIndex].Value.ToString();
txtold.Text = this.DataGridview1[3,
}
}
{
this.姓名文本框.Text = this.gridView.SelectedItems[0].subItem[0].text;
this.性别文本框.Text =this.gridView.SelectedItems[0].subItem[1].Text;
this.年龄文本框.text = this.gridView.SelsectedItems[0].subItem[2].text;
}
要注意subItem[n] n的值
GridView里面可以添加一个Select列,里面就有一个Select按钮,在那个事件里面就可以根据e.RowIndex来获取当前行里面的数据.