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.

GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

7457 Sep 25,2003 11:57 AM Sep 25,2003 02:46 PM Windows Forms 1
loading
Tags: GridControl
Serban Alexandru Florian
Asked On September 25, 2003 11:57 AM

I have a GDBG with a DataSource. The DataSource is a collection of objects with properties wich are displayed using the grid MappingName property. Some of these properties doesn`t return a basic type (string, int, etc.) but another object with properties. These objects have an overriden version of ToString() used to display them in the colums. What I would like to do, is not to display the ToString() value in the colums but one of the object`s property value. I tryed to use the DisplayMember property of the colum, setting it to the object`s property name, but I still get the ToString()value. How can I display one of the object`s property instead of the ToString version? Thank you!

Administrator [Syncfusion]
Replied On September 25, 2003 02:46 PM

You will have to implement event handlers or overrides for OnDataProviderQueryCellInfo and OnDataProviderSaveCellInfo. Suppose your dataSource has a TitleInfo object with a Title field and you only want to display the Title string in the column the you could do the following in OnDataProviderQueryCellInfo: if (e.ColIndex == yourTitleColumnIndex && e.RowIndex > 0) { e.CellValue = record.TitleInfo.Tilte; e.CellValueType = typeof(string); e.Tag = record.TitleInfo; e.Handled = true; } Setting e.Handled = true will prevent the standard handling of the grid of this column. And the grid will not retrieve the object from your underlying class. Now, your custom renderer can be a TextBox-derived cell and allow editing of the string. And it also has access to the TitleInfo object through (TitleInfo) style.Tag (in case you need that). In OnDataProviderSaveCellInfo you can then save back the modified title into the title object, e.g.: if (e.ColIndex == yourTitleColumnIndex && e.RowIndex > 0) { (((TitleInfo) style.Tag).Title = e.Style.Text; } Stefan

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.

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.

;