I have a stongly typed Dataset. From this a get a new strongly typed datarow.
I want to add this to my viewstate.
But I get the following error:
Woof
Printable View
I have a stongly typed Dataset. From this a get a new strongly typed datarow.
I want to add this to my viewstate.
But I get the following error:
Woof
Odd... the datarow class is marked serializable.
What I think, is that the datarow either contains a nonserializable member, or contains a reference to something we haven't considered yet.
I think you should add the entire datatable/dataset to viewstate.
This strongly typed DataRow is declared, Public Class bit, inside the strongly typed dataset.VB Code:
<Serializable(), _ System.ComponentModel.DesignerCategoryAttribute("code"), _ System.Diagnostics.DebuggerStepThrough(), _ System.ComponentModel.ToolboxItem(true)> _ Public Class dsBooking Inherits DataSet Private tableBookingDetail As BookingDetailDataTable Public Sub New() MyBase.New Me.InitClass Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged AddHandler Me.Tables.CollectionChanged, schemaChangedHandler AddHandler Me.Relations.CollectionChanged, schemaChangedHandler End Sub 'Blah blah blah <System.Diagnostics.DebuggerStepThrough()> _ Public Class BookingDetailRow Inherits DataRow Private tableBookingDetail As BookingDetailDataTable Friend Sub New(ByVal rb As DataRowBuilder) MyBase.New(rb) Me.tableBookingDetail = CType(Me.Table,BookingDetailDataTable) End Sub 'blah blah blah End Class End Class
As you can see the DataSet is Serializable, but the DataRow doesn't have this.
I cannot stopre the entire dataset as a function I have only returns a strongly typed datarow:
Where the booking class, Dim dt As New Booking, inherits my strongly typed dataset.VB Code:
Public Function FetchBookingToEdit(ByVal BookingKey As Integer) As Booking.BookingDetailRow Dim SQL As String = EditSQL SQL &= "WHERE BookingKey = @BookingKey " Dim Comm As New Mowlem.Data.DataLib.Command(SQL) Comm.Parameters.Add("@BookingKey", BookingKey) Dim dt As New Booking MyBase.DataLib.FillDataTable(Comm, dt.BookingDetail) If dt.BookingDetail.Rows.Count = 1 Then Return dt.BookingDetail.Item(0) End If End Function
Woof
Did you try making it serializable? Or add it to the session object(?)
Still doesn't work if I make it serializable :(
Session state...hmmmm...can't tell when a user closes down the popup window and therefore the objct will stay in the session collection. gonna reload the object of Page_load me thinks.
Booooo
woof
Just a hunch, but when you're making it serializable, mark all your methods and properties as nonserializable.
Does it work after that?