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.

QueryCellInfo event problem

Thread ID:





36565 Nov 2,2005 12:52 PM Nov 2,2005 02:17 PM Windows Forms 5
Tags: GridControl
Ken Lee
Asked On November 2, 2005 12:52 PM

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 12:59 PM

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 12:59 PM

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 01:14 PM

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 01:27 PM

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 02:17 PM

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.

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.