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

Copying a Grid??

Thread ID:

Created:

Updated:

Platform:

Replies:

16238 Jul 9,2004 07:20 AM UTC Jul 9,2004 09:02 AM UTC WinForms 5
loading
Tags: GridControl
Maqsood Ahmed
Asked On July 9, 2004 07:20 AM UTC

Can we make "Deep Copy" (not a shallow/Clone copy) of a GridControl''s object??

Administrator [Syncfusion]
Replied On July 9, 2004 07:23 AM UTC

You can make a copy of teh GridModel which holds the ''data'' for the GridControl, and use it to generate a deep copy through serilization. System.IO.MemoryStream s = new System.IO.MemoryStream(); grid.SaveBinary(s); GridControl grid1 = new GridControl(GridModel.LoadBinary(s)); s.Close();

Maqsood Ahmed
Replied On July 9, 2004 07:32 AM UTC

I got this Exception.... ************* System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed. at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) at Syncfusion.Windows.Forms.Grid.GridModel.LoadBinary(Stream s) ***************

Administrator [Syncfusion]
Replied On July 9, 2004 07:45 AM UTC

Between saving it an dreading it back, you has the reset the cursor in the IOStream. s.Seek(0, System.IO.SeekOrigin.Begin);

Maqsood Ahmed
Replied On July 9, 2004 08:39 AM UTC

Well it copies one grid to the other, but i changes many properties of the grid I copy. Such as Height, width, even Parent too. any sugestions?

Administrator [Syncfusion]
Replied On July 9, 2004 09:02 AM UTC

This code copies the GridModel which contains all the GridStyleInfo information, colwidths, etc which are properties of the grid data. It does not copy any Control properties like Control.Size or Control.Location or ????. If you need to persist things like grid.Size or grid.Location, then you would have to write them out to the memmory stream, and then read them back in separately, or you could hook into the ISerializable interface with a derived grid that serializes the properties you want to persist in your copy.

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

;