Grid如何实现如图所示功能?

chybaby 2009-03-09 10:51:58
如图
1、Grid能不能实现点击哪行就编辑哪行
2、右击菜单增中行等功能。
3、第一行固定,计算统计值(或者在未行固定动态计算统计值)
...全文
216 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
chybaby 2009-03-09
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 devilli 的回复:]
添加控件
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem addRowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteRowToolStripMenuItem;
[/Quote]
不好意思,写的不清楚 ,这是WEB的
lovele7985 2009-03-09
  • 打赏
  • 举报
回复
学学技术
flurrying 2009-03-09
  • 打赏
  • 举报
回复
很好的问题
不会,帮你顶顶
devilli 2009-03-09
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 devilli 的回复:]
添加控件
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem addRowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteRowToolStripMenuItem;
[/Quote]

然后再 this.dataGridView1.ContextMenuStrip = this.contextMenuStrip1;

在添加两个事件
private void addRowToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void deleteRowToolStripMenuItem_Click(object sender, EventArgs e)
{
}
relive_qiankai 2009-03-09
  • 打赏
  • 举报
回复
没弄过,帮顶!
Francist 2009-03-09
  • 打赏
  • 举报
回复
右键菜单吧
dataGridView1.ContextMenu
路人乙e 2009-03-09
  • 打赏
  • 举报
回复
devilli 2009-03-09
  • 打赏
  • 举报
回复
添加控件
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem addRowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteRowToolStripMenuItem;
liao5930 2009-03-09
  • 打赏
  • 举报
回复
添加个右击菜单
添加:int index = this.dataGridView1.Rows.Add();
this.dataGridView1.Rows[index].Cell[0] = "";
删除:this.dataGridView1.Rows.RemoveAt(0);
chybaby 2009-03-09
  • 打赏
  • 举报
回复
分不够,在加~~
shiboss 2009-03-09
  • 打赏
  • 举报
回复
1.grid中有个熟悉的 好像是和edit有关的属性 设置一下就是了
2.要在上面那个右键跳出菜单的那个控件
3.不是很清楚
呵呵 这个好久没用了 忘了
宝_爸 2009-03-09
  • 打赏
  • 举报
回复
这个也回一下,抢抢分:)
1、Grid能不能实现点击哪行就编辑哪行

和你的要求稍微有点不同:
GridView Examples for ASP.NET 2.0: Editing the Underlying Data in a GridView
http://msdn.microsoft.com/en-us/library/ms972948.aspx


2. 右键菜单参见:


Adding a Context Menu to ASP.NET Controls
http://msdn.microsoft.com/en-us/magazine/cc163848.aspx

Replacing the Internet Explorer context menu with a custom built context menu
http://www.codeproject.com/KB/aspnet/dynamenu.aspx

3、第一行固定,计算统计值(或者在未行固定动态计算统计值)


参考:
不过他是显示在footer上,如果你想显示在某一行上应该也好该,总之就是处理Datarowbound事件。
Displaying Summary Information in the GridView's Footer
http://www.asp.net/learn/data-access/tutorial-15-vb.aspx
relive_qiankai 2009-03-09
  • 打赏
  • 举报
回复
关注,等高人!
chybaby 2009-03-09
  • 打赏
  • 举报
回复
期待高手啊~~

111,126

社区成员

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

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

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