Click here to Skip to main content
15,925,113 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: change the webservice Pin
kubben15-Feb-07 10:09
kubben15-Feb-07 10:09 
GeneralRe: change the webservice Pin
srinandan..15-Feb-07 20:47
srinandan..15-Feb-07 20:47 
Questionplaceholder control Pin
saravanan059-Feb-07 8:18
saravanan059-Feb-07 8:18 
AnswerRe: placeholder control Pin
kubben9-Feb-07 9:52
kubben9-Feb-07 9:52 
QuestionHow do i make entire row of a datagrid clickable Pin
NetBot9-Feb-07 7:53
NetBot9-Feb-07 7:53 
AnswerRe: How do i make entire row of a datagrid clickable Pin
badgrs9-Feb-07 10:02
badgrs9-Feb-07 10:02 
GeneralRe: How do i make entire row of a datagrid clickable Pin
NetBot9-Feb-07 22:27
NetBot9-Feb-07 22:27 
QuestionXML Serialisation Pin
Sebastian T Xavier9-Feb-07 6:43
Sebastian T Xavier9-Feb-07 6:43 
Hi Guys,

I'm facing a problem in serializing a class object in VB.Net. In this case, the
class contains two public properties and an arraylist . Class structure and Code for
serialization are given below. It serializes only the public properties, not the
arraylist. It throws a "System.InvalidOperationException..The type Photos was not
expected. Use the XmlInclude or SoapInclude attribute to specify types that are not
known statically". I have no idea about where to include these attributes... Pls
help..

<br />
'Class Definition<br />
<br />
<Serializable()> _<br />
Public Class SitePhotos<br />
    Private _Outdoordesc As String<br />
    Public Property Outdoordesc() As String<br />
        Get<br />
            Return _Outdoordesc<br />
        End Get<br />
        Set(ByVal value As String)<br />
            _Outdoordesc = value<br />
        End Set<br />
    End Property<br />
<br />
    Private _ShelterEntrance As String<br />
    Public Property ShelterEntrance() As String<br />
        Get<br />
            Return _ShelterEntrance<br />
        End Get<br />
        Set(ByVal value As String)<br />
            _ShelterEntrance = value<br />
        End Set<br />
    End Property<br />
    <br />
'Arraylist to store photo descriptions<br />
<br />
    Public _PhotoList As New System.Collections.ArrayList<br />
<br />
    Public Sub AddPhoto(ByVal photoObj As Photos)<br />
        _PhotoList.Add(photoObj)<br />
    End Sub<br />
<br />
    Public Sub RemovePhoto(ByVal range As String)<br />
        Dim _pht As Photos<br />
        'Dim i As Integer<br />
<br />
<br />
        For Each _pht In _PhotoList<br />
<br />
            If _pht.posRange = range Then<br />
                _PhotoList.RemoveAt(_PhotoList.IndexOf(_pht))<br />
            End If<br />
<br />
        Next<br />
<br />
    End Sub<br />
<br />
   <br />
    Public ReadOnly Property PhotoList() As ArrayList<br />
        Get<br />
            Return _PhotoList<br />
        End Get<br />
    End Property<br />
<br />
End Class<br />
<br />
'Structure of each photo description<br />
Public Structure Photos<br />
    Public Pos As Integer<br />
    Public Desc As String<br />
    Public posRange As String<br />
End Structure<br />
<br />
<br />
<br />
'Code for serialization<br />
<br />
        Dim extraTypes(0) As Type<br />
<br />
        extraTypes(0) = GetType(SitePhotos)<br />
<br />
        Dim xSerializer As XmlSerializer = New<br />
XmlSerializer(GetType(GeneralSiteInfo.SitePhotos), extraTypes)<br />
       <br />
        Dim xWriter As StringWriter = New StringWriter()<br />
      <br />
        ' Since the serialization can exception, we'll encase it in a try/catch<br />
        ' mechanism, so we can report the error properly<br />
<br />
        Try<br />
            xSerializer.Serialize(xWriter, objPhotos)<br />
<br />
  'xmlSitePhotos is a hidden control to which i can store value. <br />
<br />
            _xmlSitePhotos.Value = xWriter.ToString()<br />
<br />
        Catch ex As Exception<br />
<br />
            MsgBox(ex.ToString())<br />
            'MsgBox("Could not serialize Site Photos", MsgBoxStyle.Critical, "Error<br />
Saving Site Photos")<br />
<br />
        End Try<br />
<br />
        xWriter.Close()<br />
<br />



thanks,

Sebastian


-- modified at 13:09 Friday 9th February, 2007
QuestionHow do i have a sortable TextBox or Dropdown Pin
www.Developerof.NET9-Feb-07 5:23
www.Developerof.NET9-Feb-07 5:23 
AnswerRe: How do i have a sortable TextBox or Dropdown Pin
badgrs9-Feb-07 10:01
badgrs9-Feb-07 10:01 
AnswerRe: How do i have a sortable TextBox or Dropdown Pin
we_swati9-Feb-07 13:47
we_swati9-Feb-07 13:47 
QuestionMicrosoft ASP.Net Ajax - Xhtml compliance Pin
Clickok9-Feb-07 5:18
Clickok9-Feb-07 5:18 
AnswerRe: Microsoft ASP.Net Ajax - Xhtml compliance Pin
badgrs9-Feb-07 10:00
badgrs9-Feb-07 10:00 
QuestionFormsAuthentication Pin
kaizenIT9-Feb-07 5:00
kaizenIT9-Feb-07 5:00 
AnswerRe: FormsAuthentication Pin
kubben9-Feb-07 7:06
kubben9-Feb-07 7:06 
AnswerRe: FormsAuthentication Pin
kaizenIT9-Feb-07 9:16
kaizenIT9-Feb-07 9:16 
QuestionHow to Export data from crystal report to Excel or pdf Pin
mohd imran abdul aziz9-Feb-07 3:51
mohd imran abdul aziz9-Feb-07 3:51 
AnswerRe: How to Export data from crystal report to Excel or pdf Pin
maabarca9-Feb-07 4:52
maabarca9-Feb-07 4:52 
QuestionDatagrid Pin
toanthinh9-Feb-07 3:50
toanthinh9-Feb-07 3:50 
AnswerRe: Datagrid Pin
postmaster@programmingknowledge.com9-Feb-07 6:18
postmaster@programmingknowledge.com9-Feb-07 6:18 
AnswerRe: Datagrid Pin
toanthinh10-Feb-07 3:26
toanthinh10-Feb-07 3:26 
GeneralRe: Datagrid Pin
toanthinh10-Feb-07 3:31
toanthinh10-Feb-07 3:31 
Question.NET Framework Pin
No-e9-Feb-07 3:06
No-e9-Feb-07 3:06 
AnswerRe: .NET Framework Pin
badgrs9-Feb-07 3:11
badgrs9-Feb-07 3:11 
AnswerRe: .NET Framework Pin
Colin Angus Mackay9-Feb-07 3:16
Colin Angus Mackay9-Feb-07 3:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.