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

getting bound row from grid row

Thread ID:

Created:

Updated:

Platform:

Replies:

1002 Sep 12,2002 09:31 AM UTC Sep 12,2002 10:26 AM UTC WinForms 2
loading
Tags: GridControl
Andre King
Asked On September 12, 2002 09:31 AM UTC

In a databoundgrid is there a way in the PrepareStyleInfo event to get a reference to the bound row of the datatable? I thought I saw this somewhere but now can't find it.

Administrator [Syncfusion]
Replied On September 12, 2002 10:13 AM UTC

You can use the currencymanager to get at the underlying datasource. To handle the problem of matching a grid row number to the correct position in the DataSource (as it might be sorted or something). you can use the Binder.RowIndexToPosition method of the grid.
Dim cm As CurrencyManager = Me.GridDataBoundGrid1.BindingContext(Me.GridDataBoundGrid1.DataSource, Me.GridDataBoundGrid1.DataMember)
	If Not cm Is Nothing Then
		' get the position in the datasource of the row in the grid
		Dim position As Integer = Me.GridDataBoundGrid1.Binder.RowIndexToPosition(e.RowIndex)
		Dim drv As DataRowView = cm.List(position)
 		'show first 3 items of the row
		'Me.Label1.Text = drv(0).ToString() + drv(1).ToString() + drv(2)
	End If

Andre King
Replied On September 12, 2002 10:26 AM UTC

Thanks, that looks like what I need, I'll try it. do you people ever sleep? :)

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

;