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

GridListControl Refreshing/Ordering

Thread ID:

Created:

Updated:

Platform:

Replies:

43222 Apr 18,2006 11:01 PM UTC Apr 20,2006 04:43 AM UTC Windows Forms 4
loading
Tags: GridControl
Prasant
Asked On April 18, 2006 11:01 PM UTC

I am having trouble adding and removing objects from a series of grid lists, as illustrated by the example included. I have coupled an ArrayList with a GridListControl, and for some reason, when I call Refresh or Update, it does not reflect the current contents of the ArrayList. Secondly, I cannot seem to rearrange the column ordering on the gridListControl. I''ve seen several examples on this forum, but none of them seem to address the actual ordering (something like enumerating an objects attribute 31, then attribute 16, then attribute 1, etc...) Lastly, removing the last item from a gridlistcontrol throws some sort of index exception. I appreciate the help, thanks, Prasant

GridListTest.zip

Administrator [Syncfusion]
Replied On April 19, 2006 12:30 PM UTC

Hi Prasant, Issue 1: Refresh issue Could you try calling the Grid''s ResetVolatileData() before refesh the GridList Control.Here is a code snippet this.returnGrid.SuspendLayout(); this.returnGrid.DataSource = this.returnList; // how do I show/order object values? //this.returnGrid.DisplayMember = "LastName"; //this.returnGrid.ValueMember = "PhoneNum"; this.returnGrid.ResumeLayout(); this.returnGrid.Grid.ResetVolatileData(); this.returnGrid.Refresh(); Here is a modified sample. http://www.syncfusion.com/Support/user/uploads/GridListTest_4e791183.zip Issue 2 : Reorder the column of the gridListControl There is no built-in support for reorder the columns in GridListControl. But, you can do it using the HashTable.You can store the Column information in HashTable and by handling GridListControl''s PrepareViewStyleInfo event. You can handle the events either at the form level, or the control level.Here is code snippet, //Form''s Load event this gridListcontrol.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { GridControl grid = sender as GridControl; if (hash.Contains(e.ColIndex)) { if (hash[e.ColIndex] != null) { e.Style.CellValueType = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].CellValueType; e.Style.Text = grid[e.RowIndex, int.Parse(hash[e.ColIndex].ToString())].Text; } } } Here is a sample for implementing it. http://www.syncfusion.com/Support/user/uploads/reorder_7dbe1840.zip Let me know if you need any further assistance. Regards, Haneef

Prasant
Replied On April 19, 2006 05:33 PM UTC

Thanks for the help. I still have the problem where removing the last element in the grid list control throws an index exception (not sure where from). This problem still seems to exist in the example you sent back to me. Is there a way to turn it off/correct if? Thanks, Prasant

Prasant
Replied On April 19, 2006 05:41 PM UTC

One more problem, if I close the dialog (regardless of whether I use it or not), the returnGridList does not populate correctly.

Administrator [Syncfusion]
Replied On April 20, 2006 04:43 AM UTC

Hi Prasant, Issue 1: You need to check the returnList ''s element count in the removeButton''s clik event.Here is a code snippet. if(this.returnList.Count > 0) { this.returnGrid.Grid.CurrentCell.MoveTo(-1,-1); this.returnList.Remove( this.returnGrid.SelectedItem ); this.returnGrid.Grid.Refresh(); } this.refreshReturnGrid(); Issue 2: Before modifying the underlying datasource of the gridlist control,You need to assign the null datasource of the gridlist control.Here is a code snippet. this.returnGrid.SuspendLayout(); this.returnGrid.DataSource = null; this.returnGrid.DataSource = this.returnList; // how do I show/order object values? this.returnGrid.ResumeLayout(); this.returnGrid.Grid.ResetVolatileData(); Here is a modified sample. http://www.syncfusion.com/Support/user/uploads/GridListTest_987afbb1.zip Please let us know if you face any problems. Thanks for your interest in Syncfusion Products. Regards, Haneef

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

;