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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:





39663 Jan 14,2006 10:13 AM Jan 16,2006 06:40 AM Windows Forms 1
Tags: GridControl
Abdul Majid
Asked On January 14, 2006 10:13 AM

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 06:40 AM

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



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.

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.