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

GGC cell text color same as backcolor

Thread ID:

Created:

Updated:

Platform:

Replies:

68611 Sep 25,2007 06:19 PM UTC Jan 4,2008 10:39 AM UTC WinForms 4
loading
Tags: GridControl
Mark
Asked On September 25, 2007 06:19 PM UTC

I have a GGC which I use to display search results on a Windows form. When I click the search button, I set the ggc.DataSource = myList;, which is a List.

I have a second button on the form used to change the date on any selected rows from the ggc. when I click this button, I save the changes and redo the search code, which resets the ggc.DataSource = myList again. I've checked and myList does contain the new Date just saved.

My problem is that the column that displays the date does not seem to be updated. When I select the row, however, the value shows up because the selected row backcolor and forecolor are set to gray and black. The unselected backcolor is white.

Why would the text not show up when the row is not selected, but show up when it is selected? And if the answer is that the forecolor is also set to white on the unselected row, why would that only happen on that column? Would it have anything to do with that column starting out empty?

I've tried a few things to set the ForeColor or TextColor on all cells, but it doesn't seem to help.

Mark

Mark
Replied On September 25, 2007 06:57 PM UTC

If this helps at all, someone just told me they thought the grid doesn't refresh if it thinks the DataSource has not changed. In my example, the same 3 records come back, with the only difference being that the date column is changed from empty to the current date.

Does anything have to be set on my object properties from the DataSource list to notify the grid that the data has changed?

Or can I force this notification?

Rajagopal [Syncfusion]
Replied On September 27, 2007 01:34 AM UTC

Hi Mark,

Thanks for your interest in Syncfusion Products.

Whenever you make any changes to the underlying datasource the ListChanged events of the attached sourcelist gets triggered. In GridGroupingControl,
the SourceListListChanged event gets triggered.

I dont see this issue of forecolor of any column being changed for the unselected rows in any of the samples. If you want to change the forecolor of any particular column in grid, then use the below code in the QueryCellStyleInfo event of grid.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el.Kind == DisplayElementKind.Record && e.TableCellIdentity.Column != null
&& e.TableCellIdentity.Column.Name == columnName)
{
e.Style.TextColor = Color.Red;
}
}

If you have any further issues on this please update us a sample showing the problem.

Regards,
Rajagopal

Mark
Replied On October 5, 2007 05:53 PM UTC

I don't think the problem is actually the forecolor that changes. I think the problem could be that my datasource doesn't get applied to the grid properly.

If I have 3 rows returned from a search I do on my db, I bind the List to the grid. _SearchController.SearchResults is the List

private void ControllerSearchResults_Changed(Object sender, EventArgs e)
{
grdPlanSearchList.DataSource = null;
grdPlanSearchList.DataSource = _SearchController.SearchResults;
}

I then select one of the 3 records and click on a button that essentially updates my LastModifiedBy and Date on the db. So once that process finishes, I redo the search automatically, so the _SearchController.SearchResults get the most recent values. At that point I fire the ControllerSearchResults_Changed event again, which should set the DataSource to the latest results.

After this is done, I check what I datasource data looks like and it is correct.

The problem is that the LastModifiedBy and LastModifiedDate columns of the grid don't seem to get refreshed. By that I mean that they stay blank. However, if I select the row that the data has been updated for, it then shows me the new values. As soon as I unselect the row, it disappears again.

Do I need to tell the grid that it's datasource has been updated, so it re-paints itself?

Administrator [Syncfusion]
Replied On January 4, 2008 10:39 AM UTC

Hi Mark,

Sorry for the delay in responding you.

Do I need to tell the grid that it's datasource has been updated, so it re-paints itself .

It is not required to explicitly update/refresh the grid when underlying datasource has been changed. The underlying datasource(List<>)includes support for change notifications when the list is modified. It does have a ListChanged event which will be fired upon any data changes. If the collection supports changes, it should also support firing a ListChanged event when the collection changes.

Hence when items are added or removed or modified from underlying datasource, the grouping grid will be notified of these changes and will update itself automatically.

Sample reference

In the sample provided, the grid gets updated automatically when items are added or removed from the underlying datasource.

http://websamples.syncfusion.com/samples/Grouping.Windows/F68611/main.htm

You can also refer the samples that shipped with Essential studio in the below location.

[Install drive]:\Documents and Settings\UserName\My Documents\Syncfusion\EssentialStudio\Version\Windows\Grid.Grouping.Windows\Samples\2.0\CustomCollections

Please let me know if you still face any issues.

Thanks for your patience.

Regards,
Jaya



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

;