473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataSourceID of .. must be the ID of a control of type IDataSource

I really do not understand what I am doing wrong.
I was trying to get familiar with WebParts and I am getting the following
error:
The DataSourceID of 'DataList1' must be the ID of a control of type
IDataSource. A control with ID 'SqlMeggitt' could not be found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Web.HttpException: The DataSourceID of 'DataList1'
must be the ID of a control of type IDataSource. A control with ID
'SqlMeggitt' could not be found.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:
[HttpException (0x80004005): The DataSourceID of 'DataList1' must be the ID
of a control of type IDataSource. A control with ID 'SqlMeggitt' could not
be found.]
System.Web.UI.WebControls.BaseDataList.ConnectToDa taSourceView() +1783839
System.Web.UI.WebControls.BaseDataList.OnLoad(Even tArgs e) +16
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
The website has only one page Default.aspx and I am trying to open a small
table using a dataList control (also I tried GridView and I has the same
results.

here is the code on the page:

<asp:WebPartZone ID="MainZone" runat="server">
<ZoneTemplate>
<asp:SqlDataSource ID="SqlMeggitt"
runat="server" ConnectionString="<%$ ConnectionStrings:MSAMFconn %>"
ProviderName="<%$ ConnectionStrings:MSAMFconn.ProviderName %>"
SelectCommand="SELECT [Value], AccessType FROM MSAMF.dbo.AccessType">
</asp:SqlDataSource>
<asp:DataList ID="DataList1" runat="server"
DataKeyField="Value" DataSourceID="SqlMeggitt">
<ItemTemplate>
Value:
<asp:Label ID="ValueLabel"
runat="server" Text='<%# Eval("Value") %>'></asp:Label><br />
AccessType:
<asp:Label ID="AccessTypeLabel"
runat="server" Text='<%# Eval("AccessType") %>'>
</asp:Label><br />
<br />
</ItemTemplate>
</asp:DataList>
</ZoneTemplate>
</asp:WebPartZone>
And here are the connectionStrings definitions (Web.config)

<connectionStrings>
<add name="MyAspNetDB"
connectionString="server=XXXX\YYYYY;database=aspne tdb;uid=sa;pwd=*******;integrated security=true" />
<add name="MSAMFconn" connectionString="Dsn=ZZZZZ;uid=sa;pwd=*****"
providerName="System.Data.Odbc" />
</connectionStrings>
Thanks,

Giovanni

Apr 25 '07 #1
0 5864

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brenden Bixler | last post by:
Using Visual Studio 2005 / ASP.NET 2.0. Newbie to ASP 2.0. I have a GridView and multiple SqlDataSource's on a single page. Each query is vastly different, but the results share a similar...
0
by: Joao Batista | last post by:
Hi all, When i run this code, it raises a error, DataList1.DataSource = pagedData ------> ... Error ..... DataList1.DataBind() Error: Both DataSource and DataSourceID are defined on...
3
by: Dan | last post by:
Hi, I'm learning asp.net 2.0 and i get this error: "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource" My code: Dim a As GridView Dim...
0
by: dgk | last post by:
I have a gridview for which the datasource at design time is a method that returns a collections.generic.List (of MyClass). That created an ObjectDataSource1 which is the DataSourceID for the...
1
by: hfritz | last post by:
Hallo, in the DefaultPage.aspx I set the department information to sessionvariable (DEP1, DEP2 ...). I want to use this department information to bind it to the Gridview-datasourceID on 10 other...
0
by: Kay | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
0
by: Kay O'Keeffe | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
1
by: byrd48 | last post by:
Hi I have a really strange problem, I'm working with a project in C# with many dropdownlists and all are databound programmatically using datasource (not datasourceid). Suddenly I am getting the...
0
by: navraj | last post by:
I am actually trying to create a mailbox enabled user in Exchange server 2003 using the sample code given from the following link http://support.microsoft.com/kb/293339 but the Idatasource saveto...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.