Problem with FormView



Ok I have a new page which I want to use a FormView. I create an object which exposes a method returning a list(of Server). Now in the designer I can drop the FormView on the page, create the ObjectDataSource from the method and I see all the properties.

Ok now my code (object)

Imports Microsoft.VisualBasic
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
imports System.Collections.Generic

Public Class SQLServer
private fgss as new list(of Server)

public sub new()

End Sub

public sub new(fgs as server)

fgss.Add(fgs)
End Sub

public function GetSever() as list(of server)
return fgss
End Function

End Class

and in the page load of the page:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.Session.Item(STR_LoginInfo) IsNot Nothing Then
linfo = Me.Session.Item(STR_LoginInfo)
xServer = linfo.SQLServer
If xServer Is Nothing Then
Exit Sub
End If
else
linfo = New LoginInfo
linfo.ServerName = STR_QLExpress
linfo.UseIntegratedSecurity = True
xServer = linfo.SQLServer
Session.Add(STR_LoginInfo, linfo)
End If

dim ss as New SQLServer (xserver)

me.FormView1.DataSourceID=nothing
me.FormView1.DataSource=ss
me.FormView1.DataBind()

End Sub


The line me.FormView1.DataSource=ss tells me that the source "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource." Now all was good in the designer so why the problem???

LLoyd Sheen

.



Relevant Pages

  • Re: Raise Events from Objects In a Collection?
    ... Public Sub DeclareObject() ... and then you would put a matching parameter in the target of the AddHandler so that it would recieve the identity of the object. ... When an object detects certain conditions in the server, it should raise an event to notify the parent application. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: client close the socket. how the server knows?
    ... the server know that the socket is closed from the client side. ... > Private Delegate Sub UpdateListBoxDel(ByVal Data As String) ... > Private Sub Button1_Click(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • .Net remoting doesnt work in Wan area.
    ... i try to broadcast events raised in server to ... Public Sub DoSomething ... Dim del As ... Dim clientProv As New BinaryClientFormatterSinkProvider ...
    (microsoft.public.dotnet.framework)
  • Re: How to get fastForward to work in the Windows Media Player Control?
    ... Sub ShutMeDown ... WMP is *client side*. ... Even if you could try to run WMP somehow at the server end, ... "Player" is not a child of Form1, it's a child of the Document object. ...
    (microsoft.public.windowsmedia.player.web)
  • Re: Chat client/server print failed
    ... is the print statement in the send_msg_all sub. ... leave the server running for testing purposes. ... # This would be the end of file, so close the client ... # just read means there is a complete request waiting ...
    (comp.lang.perl.misc)