473,795 Members | 3,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Http Exception: 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.W ebControls.Base DataList.Connec tToDataSourceVi ew() +1783839
System.Web.UI.W ebControls.Base DataList.OnLoad (EventArgs e) +16
System.Web.UI.C ontrol.LoadRecu rsive() +47
System.Web.UI.C ontrol.LoadRecu rsive() +131
System.Web.UI.C ontrol.LoadRecu rsive() +131
System.Web.UI.C ontrol.LoadRecu rsive() +131
System.Web.UI.C ontrol.LoadRecu rsive() +131
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +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:WebPartZon e ID="MainZone" runat="server">
<ZoneTemplate >
<asp:SqlDataSou rce ID="SqlMeggitt "
runat="server" ConnectionStrin g="<%$ ConnectionStrin gs:MSAMFconn %>"
ProviderName="< %$ ConnectionStrin gs:MSAMFconn.Pr oviderName %>"
SelectCommand=" SELECT [Value], AccessType FROM MSAMF.dbo.Acces sType">
</asp:SqlDataSour ce>
<asp:DataList ID="DataList1" runat="server"
DataKeyField="V alue" DataSourceID="S qlMeggitt">
<ItemTemplate >
Value:
<asp:Label ID="ValueLabel "
runat="server" Text='<%# Eval("Value") %>'></asp:Label><br />
AccessType:
<asp:Label ID="AccessTypeL abel"
runat="server" Text='<%# Eval("AccessTyp e") %>'>
</asp:Label><br />
<br />
</ItemTemplate>
</asp:DataList>
</ZoneTemplate>
</asp:WebPartZone >
And here are the connectionStrin gs definitions (Web.config)

<connectionStri ngs>
<add name="MyAspNetD B"
connectionStrin g="server=XXXX\ YYYYY;database= aspnetdb;uid=sa ;pwd=*******;in tegrated security=true" />
<add name="MSAMFconn " connectionStrin g="Dsn=ZZZZZ;ui d=sa;pwd=*****"
providerName="S ystem.Data.Odbc " />
</connectionStrin gs>
Thanks,

Giovanni

Apr 25 '07 #1
0 5897

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

Similar topics

3
4498
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 column set. Without going into details on the project constraints, I was wondering if it's possible to dynamically change the DataSourceID property of the GridView control to point to a different SqlDataSource depending on values passed from another...
0
2664
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 'DataList1'. Remove one definition.
3
5267
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 oConnection As OleDbConnection oConnection = New OleDbConnection()
0
1008
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 gridview. At run time I figured that I would just set the datasource to another List (of MyClass) which I'm actually generating on the fly. That works, but the GV can't be sorted because that relies on the DataSourceID which has to be wiped when I...
1
2320
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 pages. I need to do this, because every department has its own Database to store documentinfomations, with the same tabledesign. Know I want to build an webapplication with only one webpage per table over all Databases where I get the...
0
1349
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 textbox control which has a ‘TextMode’ property and when clicked on, displays as a dropdown list with 3 values, I want to have a similar type property with a dropdown style. So far, I have a property defined which displays the dropdown arrow...
0
1613
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 textbox control which has a 'TextMode' property and when clicked on, displays as a dropdown list with 3 values, I want to have a similar type property with a dropdown style.
1
4597
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 error that both datasource and datasourceid are defined for all my dropdownlists. If I comment one out, then another one throws the error. I have run a search through the source code both through Visual Studio and through File Explorer, and can...
0
1117
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 method is failing can anyone help me out on this i need that very urgently i have used the exact same code with some minor changes but the save to methosd just does not pass the HRESULT value i check for always fails
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.