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.
Syncfusion Feedback

get datasource datarow by grid row index

Thread ID:

Created:

Updated:

Platform:

Replies:

34808 Sep 16,2005 05:18 AM Sep 16,2005 09:23 AM Windows Forms 3
loading
Tags: GridControl
sahon
Asked On September 16, 2005 05:18 AM

I''m handling querycellinfo event and have row index, how to get apropriate datasource row by this index? DBG can have sorting

Administrator [Syncfusion]
Replied On September 16, 2005 07:32 AM

Hi, To get the corressponding record from the given rowindex, bind the grid to the datasource. The code snippet is as follows, CurrencyManager cm = (CurrencyManager) this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember]; DataRowView drv = (DataRowView)cm.Current; DataRow dr=(DataRow)drv.Row; Regards, Leo.

sahon
Replied On September 16, 2005 08:40 AM

but this code is only for current row, how can I get row by rowindex, f.e. to process querycellinfo

sahon
Replied On September 16, 2005 09:23 AM

thank you, just found: CurrencyManager cm=(CurrencyManager)BindingContext[dtg.DataSource, dtg.DataMember]; DataRow row; DataView dv=(DataView)cm.List; if (e.RowIndex>dv.Count) return; row=dv[e.RowIndex-1].Row;

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

;