How to select the full row in DataGrid
来源:互联网 发布:windows 3d图形编程 编辑:程序博客网 时间:2024/04/26 12:27
How to select the full row in DataGrid?
As a multifunctional data display control, DataGrid is used frequently in practice. Sometimes, you want to select full row in datagrid which seems as follows:
Follow me, I will tell you how to present it step by step.
First, you need to specify the Data Source of the DataGrid control. then, execute a method Modify().
System.Data.DataTable dt = Oracle.GetDataTable( sql );
dataGrid1.DataSource = dt;
Modify( this.dataGrid1 ); // Note: if the datasource is null this method will throw a exception.
the code of Modify as follows:
/// <summary>
/// 移除网格列中的TextBox
/// </summary>
/// <param name="dg">数据网格控件</param>
internal void Modify( DataGrid dg )
{
DataGridTextBoxColumn x = null;
for( int i = 0; i < dg.TableStyles[ 0 ].GridColumnStyles.Count; i ++ )
{
x = dg.TableStyles[ 0 ].GridColumnStyles[ i ] as DataGridTextBoxColumn;
x.TextBox.Parent.Controls.Remove( x.TextBox );
}
}
well, you can assign the process code of CurrentCellChanged event of DataGrid now. it’s very simple.
this.dataGrid1.Select( this.dataGrid1.CurrentRowIndex );
Btw. i like Ding.
- How to select the full row in DataGrid
- How to select the first/least/max row per group in SQL
- what is the difference of select single and select up to one row in abap
- How to collect the full path name of the files in ASM diskgroups (文档 ID 888943.1)
- How to collect the full path name of the files in ASM diskgroups (文档 ID 888943.1)
- How To Handle Row Selection in UITableView
- flex/in the datagrid,how to get the new value of cell in the datagrid after edit
- How to Capture the Row Selected on Search Page In a Variable?
- How to make two <div>…</div> in the same row?
- how to using CommandArgument in DataGrid
- How Do use the ImageButton in DataGrid...
- Multi-row Editing in the ASP.NET DataGrid...
- How to simulate FULL OUTER JOIN in MySQL
- How to support full Unicode in MySQL databases
- How to recover when the SAP spool is full
- How to monitor the full range of CPU performance events
- How to get the full error stack trace of SharePoint
- HOW TO : Select column in Notepad++
- log4j一般的使用步骤
- 苗条身材饮食守则
- 梅花雪日历控件
- 心境心静
- 转载:CMarkup介绍(二)
- How to select the full row in DataGrid
- 转载:int char* float与CString 之间的转换
- 客户端机器颜色
- 快速开发USB产品的方案(资料大派送)
- 转载:一篇关于CString类型转换的文章
- mysql 存储过程问题,惨
- 转载:C++字符串完全指南(2) - MFC类-CString
- 一个小日历控件
- 转载:剪贴板大观园