[DevExpress] GridControl selects a row based on the column, and gridcontrol hides the column.

Source: Internet
Author: User

[DevExpress] GridControl selects a row based on the column, and gridcontrol hides the column.
[DevExpress] GridControl selects a row based on the column

Key code:

/// <Summary> /// select a row based on the column /// </summary> /// <param name = "gridView"> GridView </param> /// <param name = "colName"> column name </param> // <param name = "colValue"> column value </param> public static void SelectRow (this GridView gridView, string colName, object colValue) {gridView. clearSelection (); for (int rowHandle = 0; rowHandle <gridView. rowCount; rowHandle ++) {object _ cellValue = gridView. getRowCellValue (rowHandle , ColName); if (_ cellValue! = Null) {if (_ cellValue = colValue) {gridView. SelectRow (rowHandle); break ;}}}}

Sample Code:

gcLampConfig.UIThread<GridControl>(gc => gvLampConfig.SelectRow(gcKeyFieldName, _finded.LampID));

In DEVEXPRESS, can the Add check box of gridcontrol only select one of your columns that are bound to the data source? If no data source is bound, this column is dead unless you use the Unbound field to process it yourself. If you want to start all the tasks in the unselected status, you can bind a column with "false.
Now, with gridcontrol in devexpress, how can we split the cell String Based on the mouse position when you click a cell? It is difficult to have a GridView in GridControl such as: gridview
// Click the event triggered by a cell
Void GridView_MouseUp (object sender, MouseEventArgs e)
{
GridHitInfo HitInfo = gridview. CalcHitInfo (e. Location); // obtain the cursor position
If (HitInfo. InRowCell & HitInfo. Column! = Null)
{
GridCell [] gridCells = gridview. GetSelectedCells (); // obtain the selected Cell set
Foreach (GridCell cell in gridCells) // traverses the selected cell
{
String value = gridview. GetRowCellValue (cell. RowHandle, cell. Column). ToString (); // obtain the selected cell value
// Split the cell string: value
I don't know how to separate this code.
}
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.