views:

1436

answers:

5

I am trying to populate a dropdown list control on an web page using VS 2008 and keep getting an error that it can't load the DataContext. My backend is a SQLx server 2005 DB. I create a Link To SQL data context and have 1 table in it. My LinKDataSource is as follows - asp:LinqDataSource ID="LinqDataSource1" runat="server"ContextTypeName="DACDataContext" TableName="portfolio"> /asp:LinqDataSource

My dropdown definition is: asp:DropDownList ID="ddlPortfolio" runat="server" Width="165px" DataSourceid="LinqDataSource1" DataTextField="porfolio_name" DataValueField="portfolio_id"> /asp:DropDownList I can see in my properties of my DatContext that the ContextTypeName is DACDataContext

The pecific errors I get are: HttpException (0x80004005): Could not load type 'DACDataContext'.

and

InvalidOperationException: Could not find the type specified in the ContextTypeName property of LinqDataSource 'LinqDataSource1'.]

I know this must be something really stupid but I am at my wits end.

Please help.

A: 

App Code Folder? I created a web application (first one in vs 2008) and it did not create an App Folder.

MikeD
A: 

My DACDataContext is created. Anyone have any ideas about this?

MikeD
+1  A: 

Verify that DACDataContext is public and you may also try fully qualifying the type (ie. ContextTypeName="MyNamespace.DACDataContext")

CodeChef
A: 

It is Public according to the Properties: Access Public. Also there are no Namespaces specified.

MikeD
The datacontext should still be in a namespace. Use the Object Browser to find the namespace that your datacontext belongs to.
CodeChef
A: 

Linq looks interesting but I can't get out of the blocks with it. Deadline is making me roll my own DAC which I just did and works fine. Oh well maybe when I have more time to mess with it.

MikeD
this should be a comment and not an answer
Stephen lacy