The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found.

 

Anyone help with this? i have tried lots of ways to query this database and create the insert command, including making my own data sets and setting it up that way with my own custom SQL statement.....this did not work, so i though i would use VWD 2008's own tools to create the insert, i have been left with the following error:

The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource1' could not be found.

 

Everything looks ok to me. Code below:

 

<%@ Page Title="" Language="C#" MasterPageFile="~/Helpdesk/HelpdeskMaster.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Helpdesk_Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<form id="form1" runat="server">

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"

CellPadding="4" DataSourceID="AccessDataSource1" ForeColor="#333333"

GridLines="None" Height="50px" style="font-family: Arial" Width="309px">

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<Fields>

<asp:BoundField DataField="First_Name" HeaderText="First_Name"

SortExpression="First_Name" />

<asp:BoundField DataField="Middle_Name" HeaderText="Middle_Name"

SortExpression="Middle_Name" />

<asp:BoundField DataField="Surname" HeaderText="Surname"

SortExpression="Surname" />

<asp:BoundField DataField="Location" HeaderText="Location"

SortExpression="Location" />

<asp:BoundField DataField="Job_Role" HeaderText="Job_Role"

SortExpression="Job_Role" />

<asp:BoundField DataField="Line_Manager" HeaderText="Line_Manager"

SortExpression="Line_Manager" />

<asp:CheckBoxField DataField="Desktop_user?" HeaderText="Desktop_user?"

SortExpression="Desktop_user?" />

<asp:CheckBoxField DataField="Laptop_User?" HeaderText="Laptop_User?"

SortExpression="Laptop_User?" />

<asp:BoundField DataField="W_drive_folders?" HeaderText="W_drive_folders?"

SortExpression="W_drive_folders?" />

<asp:BoundField DataField="Using_specific_software?"

HeaderText="Using_specific_software?"

SortExpression="Using_specific_software?" />

<asp:CommandField ShowInsertButton="True" />

</Fields>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<EditRowStyle BackColor="#999999" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:DetailsView>

</form>

</asp:Content>

0
paul_mc_87
2/18/2009 12:46:58 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
1360 Views

Similar Articles

[PageSpeed] 19
Get it on Google Play
Get it on Apple App Store

 Have you included an <asp:AccessDataSource> control in your .aspx file?

You need sth like this:

<asp:AccessDataSource ID="AccessDataSource1"
                      runat="server"
                      DataSourceMode="DataSet"
                      DataFile="~/App_Data/Northwind.mdb"
                      SelectCommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
                      UpdateCommand="Update Employees SET FirstName=?,LastName=?,Title=? WHERE EmployeeID=@EmployeeID">
</asp:AccessDataSource>
For detailed information on Access Data Sources you can have a look here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.accessdatasource.aspx 
  
Much ado about nothing
0
gbetsos
2/18/2009 2:07:54 PM

 

Hi thanks for reply. That code did already exist. However i now get a different error on another attempt i had made.

<%@ Page Title="" Language="C#" MasterPageFile="~/Helpdesk/HelpdeskMaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Helpdesk_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<form id="form1" runat="server">

<p>

<asp:AccessDataSource ID="AccessDataSource1" runat="server"

ConflictDetection="CompareAllValues" DataFile="~/newaccounts.mdb"

DeleteCommand="DELETE FROM [newaccounts] WHERE [Request ID] = ? AND (([First Name] = ?) OR ([First Name] IS NULL AND ? IS NULL)) AND (([Middle Name] = ?) OR ([Middle Name] IS NULL AND ? IS NULL)) AND (([Surname] = ?) OR ([Surname] IS NULL AND ? IS NULL)) AND (([Location] = ?) OR ([Location] IS NULL AND ? IS NULL)) AND (([Job Role] = ?) OR ([Job Role] IS NULL AND ? IS NULL)) AND (([Line Manager] = ?) OR ([Line Manager] IS NULL AND ? IS NULL)) AND [Desktop user?] = ? AND [Laptop User?] = ? AND (([W drive folders?] = ?) OR ([W drive folders?] IS NULL AND ? IS NULL)) AND (([Using specific software?] = ?) OR ([Using specific software?] IS NULL AND ? IS NULL))"

InsertCommand="INSERT INTO [newaccounts] (([First_Name], [Middle_Name], [Surname], [Location], [Job_Role], [Line_Manager], [Desktop_user?], [Laptop_User?], [W_drive_folders?], [Using_specific_software?]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

SelectCommand="SELECT * FROM [newaccounts]"

 

UpdateCommand="UPDATE [newaccounts] SET [First Name] = ?, [Middle Name] = ?, [Surname] = ?, [Location] = ?, [Job Role] = ?, [Line Manager] = ?, [Desktop user?] = ?, [Laptop User?] = ?, [W drive folders?] = ?, [Using specific software?] = ? WHERE [Request ID] = ? AND (([First Name] = ?) OR ([First Name] IS NULL AND ? IS NULL)) AND (([Middle Name] = ?) OR ([Middle Name] IS NULL AND ? IS NULL)) AND (([Surname] = ?) OR ([Surname] IS NULL AND ? IS NULL)) AND (([Location] = ?) OR ([Location] IS NULL AND ? IS NULL)) AND (([Job Role] = ?) OR ([Job Role] IS NULL AND ? IS NULL)) AND (([Line Manager] = ?) OR ([Line Manager] IS NULL AND ? IS NULL)) AND [Desktop user?] = ? AND [Laptop User?] = ? AND (([W drive folders?] = ?) OR ([W drive folders?] IS NULL AND ? IS NULL)) AND (([Using specific software?] = ?) OR ([Using specific software?] IS NULL AND ? IS NULL))">

<DeleteParameters>

<asp:Parameter Name="original_Request_ID" Type="Int32" />

<asp:Parameter Name="original_First_Name" Type="String" />

<asp:Parameter Name="original_Middle_Name" Type="String" />

<asp:Parameter Name="original_Surname" Type="String" />

<asp:Parameter Name="original_Location" Type="String" />

<asp:Parameter Name="original_Job_Role" Type="String" />

<asp:Parameter Name="original_Line_Manager" Type="String" />

<asp:Parameter Name="original_column1" Type="Boolean" />

<asp:Parameter Name="original_column2" Type="Boolean" />

<asp:Parameter Name="original_column3" Type="String" />

<asp:Parameter Name="original_column4" Type="String" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="First_Name" Type="String" />

<asp:Parameter Name="Middle_Name" Type="String" />

<asp:Parameter Name="Surname" Type="String" />

<asp:Parameter Name="Location" Type="String" />

<asp:Parameter Name="Job_Role" Type="String" />

<asp:Parameter Name="Line_Manager" Type="String" />

<asp:Parameter Name="column1" Type="Boolean" />

<asp:Parameter Name="column2" Type="Boolean" />

<asp:Parameter Name="column3" Type="String" />

<asp:Parameter Name="column4" Type="String" />

<asp:Parameter Name="original_Request_ID" Type="Int32" />

<asp:Parameter Name="original_First_Name" Type="String" />

<asp:Parameter Name="original_Middle_Name" Type="String" />

<asp:Parameter Name="original_Surname" Type="String" />

<asp:Parameter Name="original_Location" Type="String" />

<asp:Parameter Name="original_Job_Role" Type="String" />

<asp:Parameter Name="original_Line_Manager" Type="String" />

<asp:Parameter Name="original_column1" Type="Boolean" />

<asp:Parameter Name="original_column2" Type="Boolean" />

<asp:Parameter Name="original_column3" Type="String" />

<asp:Parameter Name="original_column4" Type="String" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Request_ID" Type="Int32" />

<asp:Parameter Name="First_Name" Type="String" />

<asp:Parameter Name="Middle_Name" Type="String" />

<asp:Parameter Name="Surname" Type="String" />

<asp:Parameter Name="Location" Type="String" />

<asp:Parameter Name="Job_Role" Type="String" />

<asp:Parameter Name="Line_Manager" Type="String" />

<asp:Parameter Name="Desktop_user?" Type="Boolean" />

<asp:Parameter Name="Laptop_User?" Type="Boolean" />

<asp:Parameter Name="W_drive_folders?" Type="String" />

<asp:Parameter Name="Using_specific_software?" Type="String" />

</InsertParameters>

</asp:AccessDataSource>

</p>

<p>

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"

CellPadding="4" DataKeyNames="Request_ID" DataSourceID="AccessDataSource1"

ForeColor="#333333" GridLines="None" Height="50px" style="font-family: Arial"

Width="441px">

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<Fields>

<asp:BoundField DataField="Request_ID" HeaderText="Request_ID"

InsertVisible="False" ReadOnly="True" SortExpression="Request_ID" />

<asp:BoundField DataField="First_Name" HeaderText="First_Name"

SortExpression="First_Name" />

<asp:BoundField DataField="Middle_Name" HeaderText="Middle_Name"

SortExpression="Middle_Name" />

<asp:BoundField DataField="Surname" HeaderText="Surname"

SortExpression="Surname" />

<asp:BoundField DataField="Location" HeaderText="Location"

SortExpression="Location" />

<asp:BoundField DataField="Job_Role" HeaderText="Job_Role"

SortExpression="Job_Role" />

<asp:BoundField DataField="Line_Manager" HeaderText="Line_Manager"

SortExpression="Line_Manager" />

<asp:CheckBoxField DataField="Desktop_user?" HeaderText="Desktop_user?"

SortExpression="Desktop_user?" />

<asp:CheckBoxField DataField="Laptop_User?" HeaderText="Laptop_User?"

SortExpression="Laptop_User?" />

<asp:BoundField DataField="W_drive_folders?" HeaderText="W_drive_folders?"

SortExpression="W_drive_folders?" />

<asp:BoundField DataField="Using_specific_software?"

HeaderText="Using_specific_software?"

SortExpression="Using_specific_software?" />

<asp:CommandField ShowInsertButton="True" />

</Fields>

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<EditRowStyle BackColor="#999999" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:DetailsView>

</p>

</form>

</asp:Content>

 

Error being generated is : You tried to assign the Null value to a variable that is not a Variant data type.

 

anyone able to help? been on this for a few hours now, i have done it before and never had such problems, loosing motivation now.

0
paul_mc_87
2/18/2009 2:33:06 PM

Hi  paul_mc_87 ,

paul_mc_87:

<InsertParameters>

<asp:Parameter Name="Request_ID" Type="Int32" />

<asp:Parameter Name="First_Name" Type="String" />

Please remove request_id parameter from InsertParameters collection .

 



Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Samu
2/20/2009 8:43:48 AM
Reply:

Similar Artilces:

The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource' could not be found.
what i'm missing that i get the error: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource' could not be found.      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="NewsId"                  EmptyDataText="There are no data records to display.">          &nb...

The DataSourceID of 'gv2' must be the ID of a control of type IDataSource. A control with ID 'objDs1' could not be found.
i have a radiobutton list and gridview and a object data source at runtime i'm changing the object data source by clicking on the radiobutton list selected index changed and here is my source code....          <asp:RadioButtonList runat="server" ID="rblView" RepeatDirection="Horizontal" RepeatLayout="Flow" AutoPostBack="True" OnSelectedIndexChanged="rblView_SelectedIndexChanged">                &nb...

How do fix the error The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource. A control with ID 'SqlMedTable' could not be found.
How do you fix the error: The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource.  A control with ID 'SqlMedTable' could not be found.Here is the code.protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {MedicalClassLibrary.Connection c = new MedicalClassLibrary.Connection(); c.GetMedicalTable();DataGrid1.AutoGenerateColumns = true; DataGrid1.DataSource = c.DS;InputDiv.Visible = false;Label1.Visible = false; txtRx.Focus(); } } Here is the class medhod:public void GetMedicalTable() {string medTable = "SELECT ...

The DataSourceID of 'ddlDevice' must be the ID of a control of type IDataSource. 'dsMain' is not an IDataSource.
I seem to be having trouble binding the objects in my page to the datasource. The subject line contains the error message that I keep receiving.  I am trying to bind a dropdownlist with my datasource.  I noticed that if I click on the droplist, go to the properties window and try to select a datasource; nothing is listed. Post the code for filling dsMainNC... How did you setup the datasrouce? I think you didnt use the wizard to connect into database. You will not see any datasrouce in the properties window till u use the wizard to (server explorer) create the databa...

The DataSourceID of '' must be the ID of a control of type IDataSource
I have a grid view with dropdown list. I have to be able to edit it by clicking on ‘Edit’ link button. Dropdown at this point should be populated with data.1. I need to display one of the values of the dropdown in the grid (read only). This value is what is coming to populate entire row of the grid view. Even I do not have an error on initial load of grid view and while debugging I see a data coming to populate grid view row and a dropdown, the column is empty. How can I populate a value of the grid view column of the row as a selected field of the dropdown? 2. I am getting an error when l...

DataSourceID of 'controlname' must be the ID of a control of type IDataSource.
When I use the following code, I get this error:The DataSourceID of 'PSAnswersGridView' must be the ID of a control of type IDataSource.  A control with ID 'Key_Trait_Analysis_ObjectDataSource' could not be found.I am trying to define an objectdatasource in code-behind and bind it to a gridview:Partial Class Admin_StuffInherits System.Web.UI.PageProtected Key_Trait_Analysis_ObjectDataSource As ObjectDataSourceProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadIf Not Page.IsPostBack Then...  Key_Trait_Analysis_ObjectDataSource...

3.1 Parser Error: Could not load type or Multiple controls with the same ID 'ctr' were found. FindControl requires that controls have unique IDs.
I have about ten cusom modules on my local machine and everything worked for about two weeks. Today I created new skin object and uploaded it and now none of my modules work. I get either error Parser Error: Could not load type ..." or Multiple controls with the same ID 'ctr' were found. FindControl requires that controls have unique IDs depending on which page I look at. None of these pages used skin with a new skin object. Btw, I stripped skin object down to noting, no controls, no code and no changes to custom modules have been made. I wonder if  skin object update screwed ...

Target control with ID '' could not be found for extender '_AccordionExtender'.
Hey Folks, I'm trying to use the accordian in a page that uses a master page and I'm receiving this error.  I've place the following code inside the content place holder tag on the page.<atlasToolKit:Accordion runat='server' SelectedIndex='0' ID="Accordion1" AutoSize="None"FadeTransitions="true"TransitionDuration="250"FramesPerSecond="40"><Panes><atlasToolKit:AccordionPane><Header>Pane 1 </Header><Content> This is pane 1</Content></atlasToolKit:AccordionPa...

multiple controls with the same id ' ' were found, findcontrol requires that controls have unique ids
i am getting array of object from Object layer.. and  i am  iterating through array of item  and dynamically creating the linkbuttons. and displaying  them in the form of  set of breadcrumb.when i click on linkbutton in the breadcrumb it is saying "multiple controls with the same id ' ' were found, findcontrol requires that controls have unique ids;;; Can you please help me out here           Can you post your aspx file so we can see how your id's are laid out?Please mark post as answerObilit.com - Progressive Web ...

Multiple controls with the same ID 'xxx' were found. FindControl requires that controls have unique IDs.
I have a Web User Control that uses Controls.Add() to "copy" a Panel from the containng page, into itself (a nested Panel control) but as the page renders, I get the following message: Multiple controls with the same ID 'xxx' were found. FindControl requires that controls have unique IDs. I guess it makes sense, but how to I "copy" a control to my WUC without getting this error? I am trying to do what the Atlas CollapsiblePanelExtender does when you associate Panels for it to use.http://www.geneangelo.com You can always associate a unique ID to control ..... you can use Guid as ID The...

Multiple controls with the same ID 'aspnetForm' were found. Trace requires that controls have unique IDs.
I am getting this error: Multiple controls with the same ID 'aspnetForm' were found. Trace requires that controls have unique IDs. I have pin pointed the error to <form> tag. I am using master page, which has form tag. This page which is content of master page works if there is not <form id...> </form> tag. I added form to set value using javascript and now getting this error. Here is the code of this page: <%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage1.master" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" Title="test"%><asp:...

Multiple controls with the same ID 'ctl00' were found. FindControl requires that controls have unique IDs.
Does anyone understand how to fix this error, code was working fine. Its just a gridview pulling from a datasource.   Software Coding Is No Monkey Business! This error occurs when the the edit button is clicked on the gridview for a particular record. Has anyone seen this error, the help link on this did not help out one bit. Software Coding Is No Monkey Business! I noticed that this error is not in my aspx page but in ScriptControlBase.csSoftware Coding Is No Monkey Business!   SoftwareCodingMonkey:Does anyone understand how to fix this error, code was working...

Multiple controls with the same ID 'TextBoxID1' were found. FindControl requires that controls have unique IDs.
Hi i get this error when i try to add textboxes dynamically, the problem occurs when i try to add a new set of textboxes after I have already done so. Here is what my code looks like; protected void btnSubmit_Click(object sender, EventArgs e) { try { //create a new instance of the control TextBox new_TextBox1 = new TextBox(); new_TextBox1.ID = txtID.Text; new_TextBox1.Text = "Please Insert a Question"; txt_arr[txt_count++] = new_TextBox1; //call our add function add_Textbox(new_TextBox1); ...

Multiple controls with the same ID 'ctr' were found. FindControl requires that controls have unique IDs.
After upgrading to DNN 3.0.9 From DNN 2.1.2 I got the following error when displaying my home page: A critical error has occurred. Multiple controls with the same ID 'ctr' were found. FindControl requires that controls have unique IDs. The only modules I have installed are the CATALooK store modules. Where do I look in the database for the ID this error message is talking about? I have looked at the modules and modulecontrols tables all of the IDs look unique. I did notice that in modulecontrols table the ModuleDefID field is null in some of the rows is this correct? Or...

Web resources about - The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found. - asp.net.presentation-controls

Resources last updated: 1/16/2016 3:33:29 PM