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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

No subject

Thread ID:





3518 Mar 26,2003 06:21 PM UTC Mar 26,2003 11:00 PM UTC WinForms 1
Tags: GridControl
Andy Ullman
Asked On March 26, 2003 06:21 PM UTC

I want to use the rowheader area of a databound grid to indicate rows that have been modified and rows that are new (inserted). The code below works great for the modified rows, but with new rows (inserted via the asterisk on the grid navigation control) I get some weird display artifacts (new row flickering on/off as the datagrid is scrolled). Also, if I insert a new row into the datatable by calling InsertAt and operating directly on the datatable, the rowheader displays "New" where the new row -should- appear, but the new, blank row appears at the bottom of the datagrid. This code is from a control that inherits from GridDataBoundGrid: protected override void OnPrepareViewStyleInfo(Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { base.OnPrepareViewStyleInfo(e); if(e.ColIndex == 0 && e.RowIndex > 0) { int position = Binder.RowIndexToPosition(e.RowIndex); e.Style.CellType = "Header"; if ((DataSource as DataSet).Tables[DataMember].Rows[position].RowState == DataRowState.Modified) { e.Style.Text = "Mod"; e.Style.BackColor = Color.Red; } else if ((DataSource as DataSet).Tables[DataMember].Rows[position].RowState == DataRowState.Added) { e.Style.Text = "New"; e.Style.BackColor = Color.LightGreen; } } } Thanks Andy

Administrator [Syncfusion]
Replied On March 26, 2003 11:00 PM UTC

If you use this code, you will get the inserted row displayed in the correct position.
private void button1_Click(object sender, System.EventArgs e)
	DataRow dr = dt.NewRow();
	dr[0] = "XXXXX";  //dt is the datatable
BUT, this will not show your red new row tag because of the dt.AcceptChanges call. But without this call, the new datarow is not position so the grid can see it properly located in the data source. Maybe you can use some other marker to get the red row flags. Maybe save a list of them or something.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon