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. Image for the cookie policy date

Setting cell font based on data in different column in datatable

I am using a GridDataBoundGrid and I want to set the font in a cell conditional on the value of a column in the same row in the bound datatable. I know I need to handle PrepareViewStyleInfo to do this but how do I retrieve the datarow based on the GridPrepareViewStyleInfoEventArgs? VB.net please. Thanks.

4 Replies

AD Administrator Syncfusion Team May 16, 2004 06:40 PM

You can get the DataRowView from the CurrencyManager. Dim cm As CurrencyManager = CType(Me.BindingContext(Me.gridDataBoundGrid1.DataSource, Me.gridDataBoundGrid1.DataMember), CurrencyManager) Dim position As Integer = Me.gridDataBoundGrid1.Binder.RowIndexToPosition(e.RowIndex) Dim drv As DataRowView = cm.List(position) Here is a little sample. WindowsApplication2_7932.zip


PN Patrick Noble May 21, 2004 03:02 PM

That worked fine, then I discovered that when the splitter control is used, the font is changed on only one side of the splitter bar. How do I get it to be the same on both sides?


AD Administrator Syncfusion Team May 21, 2004 03:18 PM

If you are subscribing to events in a splitter/navigation control, then you have to subscribe to the event in the PaneCreated event and unsubscribe to them in the PaneClosing event. The reason is that as the splitter comes and goes, grids are created and destroyed. So, you havr to rewire the events for the new grids. Here is a KB on this problem. http://www.syncfusion.com/Support/article.aspx?id=580


SH Sue Harris May 23, 2004 04:24 PM

I also found that the ContextMenu property (if set) needs to be copied when creating the new grids.

Loader.
Live Chat Icon For mobile
Up arrow icon