Problem with FormView

L

Lloyd Sheen

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
 

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,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top