473,473 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to copy an entire object

Hi, I am almost new here and a newbie in ASP.NET and .NET in general.

How can I make just that ?
I have tried at least 5 different ways of doing that and I just can't:

I have a data-bound Datagrid in a Web form, wich I want to save because when
I display it, I manually truncate some values (to mantain a one-line per
record
view)

If I save the Datagrid to the Session in advance, the later truncation of
values
in the Datagrid still affect the saved version; can't understand why.

It seems that is a refernce that is getting into the session, and not the
Datagrid as a whole !!

Is there a better way of doing this value formatting thing (truncate
strings), and
prevent word wrap and column resize ?

Nov 19 '05 #1
2 1484
The only way to copy an object in .NET is if the object allows you to via
supporting the IClonable interface. So if the object has a Clone method,
then you can make a copy of it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi, I am almost new here and a newbie in ASP.NET and .NET in general.

How can I make just that ?
I have tried at least 5 different ways of doing that and I just can't:
I have a data-bound Datagrid in a Web form, wich I want to save
because when
I display it, I manually truncate some values (to mantain a one-line
per
record
view)
If I save the Datagrid to the Session in advance, the later truncation
of
values
in the Datagrid still affect the saved version; can't understand why.
It seems that is a refernce that is getting into the session, and not
the Datagrid as a whole !!

Is there a better way of doing this value formatting thing (truncate
strings), and prevent word wrap and column resize ?


Nov 19 '05 #2
Thanks for your help.
I am still dealing with this but I think the best way should be picking just
the
values I need to preserve to another type of data structure and put that
on session. Then restoring from there (because there is no clone method
for the datagrid). If not the easy way, at least this should be reasonably
light
on resources...
"Brock Allen" wrote:
The only way to copy an object in .NET is if the object allows you to via
supporting the IClonable interface. So if the object has a Clone method,
then you can make a copy of it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi, I am almost new here and a newbie in ASP.NET and .NET in general.

How can I make just that ?
I have tried at least 5 different ways of doing that and I just can't:
I have a data-bound Datagrid in a Web form, wich I want to save
because when
I display it, I manually truncate some values (to mantain a one-line
per
record
view)
If I save the Datagrid to the Session in advance, the later truncation
of
values
in the Datagrid still affect the saved version; can't understand why.
It seems that is a refernce that is getting into the session, and not
the Datagrid as a whole !!

Is there a better way of doing this value formatting thing (truncate
strings), and prevent word wrap and column resize ?


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rob Meade | last post by:
Hi all, I have an application writing directories as and when needed, there is a template directory which contains 5 files that I need to copy into each new directory. I initially looked at the...
42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
8
by: trying_to_learn | last post by:
Why do we need to explicitly call the copy constructor and the operator = , for base class and member objects in composition? ....book says "You must explicitly call the GameBoard copy-constructor...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
2
by: Steve Franks | last post by:
The Copy Web tool provided with VS.NET 2005 is very convenient. However every once in a while it seems to think the files on the remote server have changed, which they have not. Then when I use...
5
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
5
by: Muskito | last post by:
Hi, Is it possible to copy the entire List(Of type) object to another List(Of type) object (they are both of the same type ofcourse) - without keeping the reference? There's the CopyTo...
1
by: illegal.prime | last post by:
I would like to have an array of objects (whose class I define) and then just invoke either: MyClass clonedArray = (MyClass) myArray.Clone(); OR Array.Copy(myArray, clonedArray, myArray.Length);...
34
by: =?ISO-8859-1?Q?Marcel_M=FCller?= | last post by:
Hi, is there a way to avoid the automatic copy constructor generation. I do not want the object to be non-copyable. I simply do not want that copying is done by the default copy constructor. But...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.