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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

QueryCellInfo event problem

Thread ID:





36565 Nov 2,2005 05:52 PM UTC Nov 2,2005 07:17 PM UTC WinForms 5
Tags: GridControl
Ken Lee
Asked On November 2, 2005 05:52 PM UTC

I''m using GDBG to implement unbound column, in QueryCellInfo event, I use the GridBoundRecordState object to get DataRow property , when I want retrive the column in DataRow, it always get the value of the first row. even the GridBoundRecordState.Position had changed but the column value of DataRow always show the value of first row. How can I solve the problem? Thank a lot

Administrator [Syncfusion]
Replied On November 2, 2005 05:59 PM UTC

Are you using hierarchical data? If state is teh GridBoundRecordState, are you using code like: DataRowView drv = state.Table[state.Position] as DataRowView; to get at the DataRowView? If this does not help, post the code you are trying to use.

Ken Lee
Replied On November 2, 2005 05:59 PM UTC

if( e.ColIndex==_GridCustomerInfo.Binder.NameToColIndex("AltName") && e.RowIndex>0 && e.ColIndex>0) { int _Position = _GridCustomerInfo.Binder.RowIndexToPosition( e.RowIndex); GridBoundRecordState _RecordState = _GridCustomerInfo.Binder.GetRecordStateAtRowIndex( e.RowIndex); if( _RecordState!=null) { System.Data.DataRowView _DRV = _RecordState.ListManager.Current as System.Data.DataRowView; if( _DRV!=null) { ROW_OB_CUSTOMERINFO _CurrentRow = _DRV.Row as ROW_OB_CUSTOMERINFO; if( _CurrentRow.CUSTOMERTYPE=="PE" ) { e.Style.CellValue = String.Format( "{0}", _CurrentRow.FULLNAME); } else { e.Style.CellValue = String.Format( "{0}", _CurrentRow.COMPANYNAME); } Console.WriteLine( "Position:{0}, Row:{1}, Col:{2}, Pos:{3}, CustomerID:{4}", new object[] {_Position, e.RowIndex, e.ColIndex, _RecordState.Position, _CurrentRow.CUSTOMERID}); e.Handled = true; } } }

Ken Lee
Replied On November 2, 2005 06:14 PM UTC

Sorry, It''s work as your mention. The other point when I click on the unbound cell, in the first column should have array icon that show the current position, but it was not display, when click on the bound cell is normally shown, what''s happen in this case ? thanks.

Administrator [Syncfusion]
Replied On November 2, 2005 06:27 PM UTC

System.Data.DataRowView _DRV = _RecordState.ListManager.Current as System.Data.DataRowView; This does not give you the datarowview of the grid row being drawn. It gives you the datarowview corresponding to the row with the triangle in the row header. QueryCellInfo is hit for any row that needs to be drawn, not just the current one (the one pointed to by the CurrencyManager). If you are using hierarchical data, you should try the code I suggested above. If it is a flat grid, then you can get the DataRowView using: int position = grid.Binder.RowIndexToPosition(e.RowIndex); CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; DataRowView drv = cm.List[position] as DataRowView;

Ken Lee
Replied On November 2, 2005 07:17 PM UTC

It did help to me Thanks Clay Burch


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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