how to copy an entire object

G

Guest

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 ?
 
B

Brock Allen

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top