Conservar estado control personalizado

  • Thread starter Rigoberto Cifuentes
  • Start date
R

Rigoberto Cifuentes

Hola a todos:
Estoy intentando hacer un control y necesito mantener el
estado de la siguiente colección que he creado:
public struct ColumnaGrid
{
public string TituloCabecera;
public int LongitudCabecera;
.........
}
[Serializable()]
public class ColeccionColumnasGrid:System.Collections.CollectionBase
{
public ColumnaGrid Item(int indice)
{
return (ColumnaGrid) List[indice];
}
public void Add(ColumnaGrid objColumnaGrid)
{
List.Add(objColumnaGrid);
}
........}
La estoy intentando guardar en el viewstate pero no hay
forma, uso lo siguiente.
public ColeccionColumnasGrid ColumnasGrid
{
get
{
ColeccionColumnasGrid columnasGrid;
columnasGrid=(ColeccionColumnasGrid) ViewState ["columnasGrid"];
return columnasGrid;
}
set
{
ViewState["columnasGrid"]=value;
}
}
He leido algo de que hay que serializarla pero no se como
hacerlo.
A ver si alguien me puede echar una manita.
Muchas gracias.
..
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hola!

Well, my Spanish is poor indeed, so if I got it right, you have problems
serializing the ColeccionColumnasGrid collection instance.
You can try searching the MSDN Magazine archives for an Aaron Skonnard's
article on XML serialization. This article, I remember, covered the issues
of serializing collections and hashtables
 

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

Similar Threads


Top