社区
C#
帖子详情
怎样在DataGrid中加入checkBox
xhjdxx
2003-07-18 10:04:01
如上
...全文
67
3
打赏
收藏
怎样在DataGrid中加入checkBox
如上
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
雪狼1234567
2003-07-18
打赏
举报
回复
// Step 1. Derive a custom column style from DataGridTextBoxColumn
// a) add a ComboBox member
// b) track when the combobox has focus in Enter and Leave events
// c) override Edit to allow the ComboBox to replace the TextBox
// d) override Commit to save the changed data
// Step 2 - Use the combo column style
// Add 1 col with combo style
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
ComboTextCol.MappingName = "custCity";
ComboTextCol.HeaderText = "Customer Address";
ComboTextCol.Width = 100;
ts1.GridColumnStyles.Add(ComboTextCol);
// Step 3 - Additional setup for Combo style
// a) make the row height a little larger to handle minimum combo height
ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3;
// b) Populate the combobox somehow. It is a normal combobox, so whatever...
ComboTextCol.ColumnComboBox.Items.Clear();
ComboTextCol.ColumnComboBox.Items.Add("Chicago");
ComboTextCol.ColumnComboBox.Items.Add("Corvallis");
ComboTextCol.ColumnComboBox.Items.Add("Denver");
ComboTextCol.ColumnComboBox.Items.Add("Great Falls");
ComboTextCol.ColumnComboBox.Items.Add("Kansas City");
ComboTextCol.ColumnComboBox.Items.Add("Los Angeles");
ComboTextCol.ColumnComboBox.Items.Add("Raleigh");
ComboTextCol.ColumnComboBox.Items.Add("Washington");
// c) set the dropdown style of the combo...
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
xhjdxx
2003-07-18
打赏
举报
回复
参考如下代码:
// Step 1. Derive a custom column style from DataGridTextBoxColumn
// a) add a ComboBox member
// b) track when the combobox has focus in Enter and Leave events
// c) override Edit to allow the ComboBox to replace the TextBox
// d) override Commit to save the changed data
// Step 2 - Use the combo column style
// Add 1 col with combo style
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
ComboTextCol.MappingName = "custCity";
ComboTextCol.HeaderText = "Customer Address";
ComboTextCol.Width = 100;
ts1.GridColumnStyles.Add(ComboTextCol);
// Step 3 - Additional setup for Combo style
// a) make the row height a little larger to handle minimum combo height
ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3;
// b) Populate the combobox somehow. It is a normal combobox, so whatever...
ComboTextCol.ColumnComboBox.Items.Clear();
ComboTextCol.ColumnComboBox.Items.Add("Chicago");
ComboTextCol.ColumnComboBox.Items.Add("Corvallis");
ComboTextCol.ColumnComboBox.Items.Add("Denver");
ComboTextCol.ColumnComboBox.Items.Add("Great Falls");
ComboTextCol.ColumnComboBox.Items.Add("Kansas City");
ComboTextCol.ColumnComboBox.Items.Add("Los Angeles");
ComboTextCol.ColumnComboBox.Items.Add("Raleigh");
ComboTextCol.ColumnComboBox.Items.Add("Washington");
// c) set the dropdown style of the combo...
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
TheAres
2003-07-18
打赏
举报
回复
5.11 How can I put a checkbox in a column of my DataGrid?
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q754q
DataGrid
中
加入
CheckBox
,并实现单选
第一次发表,不会写.直接把原文件给大家看算了!!原理就是用JS遍列所有
CheckBox
把所有
CheckBox
设为未被选
中
,然后在把单击的
CheckBox
设为选
中
以下是.ASPX文件 WebForm1 http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> function
在
DataGrid
中
加入
了一列
checkbox
用来控制删除多行
我在
DataGrid
中
加入
了一列
checkbox
用来控制删除多行可是发现了一个问题,就是假如我的分页为每页3行当我把一页的所有记录行全部删除时,会出现当前索引错误我想如果全部删除1.后面没有记录跳到前一个页面 2.后面有记录自动显示后面的记录本文介绍如何在ASP.NET
中
实现多页面选择的问题。其具体思路很简单:用隐藏的INPUT记住每次选择的项目,在进行数据绑定时,检...
我在
DataGrid
中
加入
了一列
checkbox
用来控制删除多行
我在
DataGrid
中
加入
了一列
checkbox
用来控制删除多行可是发现了一个问题,就是假如我的分页为每页3行当我把一页的所有记录行全部删除时,会出现当前索引错误我想如果全部删除1.后面没有记录跳到前一个页面 2.后面有记录自动显示后面的记录本文介绍如何在ASP.NET
中
实现多页面选择的问题。其具体思路很简单:用隐藏的INPUT记住每次选择的项目,在进行数据绑定时,检...
DataGrid
中
加入
CheckBox
,并实现单选 选择自 listhome 的 Blog
原理就是用JS遍列所有
CheckBox
把所有
CheckBox
设为未被选
中
,然后在把单击的
CheckBox
设为选
中
以下是.ASPX文件 WebForm1 http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> function Set
CheckBox
State() {
Flex
中
DataGrid
实现列(包括头部)
中
加入
CheckBox
全选功能
在
DataGrid
中
实现列
中
加入
CheckBox
这种用法很常见,项目
中
也经常会用到,在网上搜了下基本就是实现itemRender.但是 感觉网上提供的实现上好些地方都是多余的 经过自己的改造感觉还行 附上代码,同时希望大家举一反三 能实现添加其他组件到
DataGrid
列
中
贴出自己
C#
111,128
社区成员
642,536
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章