We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to access column of a grid by its bound field?

Thread ID:

Created:

Updated:

Platform:

Replies:

39663 Jan 14,2006 03:13 PM UTC Jan 16,2006 11:40 AM UTC WinForms 1
loading
Tags: GridControl
Abdul Majid
Asked On January 14, 2006 03:13 PM UTC

How can I access a column of a bound grid by the field? If I have bound a grid by a table "Projects", and I want to read the data of ProjectId or any other column by Field name; upon double click event of the row; then I should be able to read the data of that column. Somthing like that syncFindGrid.Columns("ProjectId").text syncFindGrid.Columns("LocationId").text etc I don''t want to use (Colindex,Rowindex).text methos because I am not sure of the index of the columns, since I am filling it for different fomrs with different tables.

Administrator [Syncfusion]
Replied On January 16, 2006 11:40 AM UTC

Hi Abdul, To access a column value based on its fieldname or column name, make use of the NameToColIndex property of the grid. Inserting the following code in the CellDoubleClick Event of the grid achieves the same. int colInd = this.gridDataBoundGrid1.Binder.NameToColIndex("Col1"); // specify the column name here MessageBox.Show(this.gridDataBoundGrid1.Model[e.RowIndex,colInd].CellValue.ToString()); On double clicking any row you can view that particular column value. Please refer the sample attached for demonstration of these functionalities. Thanks, Rajagopal

ColAccessSample.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;