I'm getting errors after introducing Accordion/Accordion Panes into my code.
Can I get some assistance with this? I'm new to ASP.NET so I am still learning how to use its features.
This is the error:
Could not find control 'ProjInfoGridView' in ControlParameter 'ProjectNum'. 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.InvalidOperationException: Could not find control 'ProjInfoGridView' in ControlParameter 'ProjectNum'.
This is my code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Projects.aspx.cs" Inherits="MOSDP.Projects" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:Accordion ID="Accordion1" runat="server"><Panes><asp:AccordionPane ID="AccordionPane1" runat="server"><Header><h2>Project List</h2></Header><Content><%-- PROJECT LIST --%><%-- PROJECT LIST --%><%-- PROJECT LIST --%><asp:EntityDataSource ID="ProjInfoDataSource" runat="server" ContextTypeName="MOSDP.DAL.DPEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="ProjectInfoes"></asp:EntityDataSource><br /><h2>Project List</h2><br /><asp:GridView ID="ProjInfoGridView" runat="server" DataSourceID="ProjInfoDataSource" AutoGenerateColumns="False" DataKeyNames="ProjectNum" AllowPaging="True"><Columns><asp:CommandField ShowSelectButton="True" /><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" ReadOnly="True" SortExpression="ProjectNum" /><asp:BoundField DataField="ProjectName" HeaderText="ProjectName" SortExpression="ProjectName" /><asp:BoundField DataField="DateCreated" HeaderText="DateCreated" SortExpression="DateCreated" /><asp:BoundField DataField="LastUpdated" HeaderText="LastUpdated" SortExpression="LastUpdated" /><asp:BoundField DataField="Balance" HeaderText="Balance" SortExpression="Balance" /><asp:BoundField DataField="CabinetApprSum" HeaderText="CabinetApprSum" SortExpression="CabinetApprSum" /><asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /></Columns><EmptyDataTemplate> There are no records in this list.</EmptyDataTemplate></asp:GridView><br /><asp:DetailsView ID="ProjInfoDetailsView" runat="server" Height="50px" Width="125px" AllowPaging="True" AutoGenerateRows="False" DataKeyNames="ProjectNum" DataSourceID="ProjInfoDataSource" DefaultMode="Insert"><Fields><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" ReadOnly="True" SortExpression="ProjectNum" /><asp:BoundField DataField="ProjectName" HeaderText="ProjectName" SortExpression="ProjectName" /><asp:BoundField DataField="DateCreated" HeaderText="DateCreated" SortExpression="DateCreated" /><asp:BoundField DataField="LastUpdated" HeaderText="LastUpdated" SortExpression="LastUpdated" /><asp:BoundField DataField="Balance" HeaderText="Balance" SortExpression="Balance" /><asp:BoundField DataField="CabinetApprSum" HeaderText="CabinetApprSum" SortExpression="CabinetApprSum" /><asp:TemplateField HeaderText="Type" SortExpression="Type"><EditItemTemplate><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Type") %>'></asp:TextBox></EditItemTemplate><InsertItemTemplate><asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Type") %>'><asp:ListItem>CF</asp:ListItem><asp:ListItem>IDF</asp:ListItem></asp:DropDownList></InsertItemTemplate><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("Type") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:CommandField ShowInsertButton="True" /></Fields></asp:DetailsView></Content></asp:AccordionPane><asp:AccordionPane ID="AccordionPane2" runat="server"><Header><h2>Add a Document</h2></Header><Content><%-- DOCUMENT --%><%-- DOCUMENT --%><%-- DOCUMENT --%><br /><h2>Add a Document</h2><asp:EntityDataSource ID="DocEntityDataSource" runat="server" ContextTypeName="MOSDP.DAL.DPEntities" EnableFlattening="False" EntitySetName="Documents" EnableInsert="True" Where="it.ProjectNum = @ProjectNum"><WhereParameters><asp:ControlParameter ControlID="ProjInfoGridView" Name="ProjectNum" PropertyName="SelectedValue" Type="Int32" /></WhereParameters></asp:EntityDataSource><br /><asp:GridView ID="DocGridView" runat="server" AllowPaging="True" DataSourceID="DocEntityDataSource" AutoGenerateColumns="False" DataKeyNames="DocumentID"><Columns><asp:BoundField DataField="DocumentID" HeaderText="DocumentID" ReadOnly="True" SortExpression="DocumentID" /><asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" SortExpression="ProjectNum" /></Columns><EmptyDataTemplate> There are no records in this list.</EmptyDataTemplate></asp:GridView><br /><asp:DetailsView ID="DocDetailsView" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="DocumentID" DataSourceID="DocEntityDataSource" DefaultMode="Insert"><Fields><asp:BoundField DataField="DocumentID" HeaderText="DocumentID" ReadOnly="True" SortExpression="DocumentID" /><asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /><asp:TemplateField HeaderText="ProjectNum"><InsertItemTemplate><asp:EntityDataSource ID="ProjDDLEntityDataSource" runat="server" ConnectionString="name=DPEntities" DefaultContainerName="DPEntities" EnableDelete="True" EnableFlattening="false" EntitySetName="ProjectInfoes" EntityTypeFilter="ProjectInfo"></asp:EntityDataSource><asp:DropDownList ID="ProjInfoesDropDownList" runat="server" DataSourceID="ProjDDLEntityDataSource" DataTextField="ProjectNum" DataValueField="ProjectNum" OnInit="ProjInfoesDropDownList_Init"></asp:DropDownList></InsertItemTemplate></asp:TemplateField><asp:CommandField ShowInsertButton="True" /></Fields></asp:DetailsView></Content></asp:AccordionPane><asp:AccordionPane ID="AccordionPane3" runat="server"><Header><h2>Add an Allocation</h2></Header><Content><%-- ALLOCATION --%><%-- ALLOCATION --%><%-- ALLOCATION --%><br /><h2>Add an Allocation</h2><asp:EntityDataSource ID="AllocEntityDataSource" runat="server" ContextTypeName="MOSDP.DAL.DPEntities" EnableFlattening="False" EntitySetName="Allocations" Where="it.ProjectNum = @ProjectNum" ConnectionString="name=DPEntities" DefaultContainerName="DPEntities" EnableInsert="True"><WhereParameters><asp:ControlParameter ControlID="ProjInfoGridView" Name="ProjectNum" PropertyName="SelectedValue" Type="Int32" /></WhereParameters></asp:EntityDataSource><br /><asp:GridView ID="AllocGridView" runat="server" DataSourceID="AllocEntityDataSource" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="AllocationID"><Columns><asp:BoundField DataField="AllocationID" HeaderText="AllocationID" ReadOnly="True" SortExpression="AllocationID" /><asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" /><asp:BoundField DataField="OriginalAlloc" HeaderText="OriginalAlloc" SortExpression="OriginalAlloc" /><asp:BoundField DataField="RevisedAlloc" HeaderText="RevisedAlloc" SortExpression="RevisedAlloc" /><asp:BoundField DataField="Balance" HeaderText="Balance" SortExpression="Balance" /><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" SortExpression="ProjectNum" /></Columns><EmptyDataTemplate> There are no records in this list.</EmptyDataTemplate></asp:GridView><br /><asp:DetailsView ID="AllocDetailsView" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="AllocationID" DataSourceID="AllocEntityDataSource" DefaultMode="Insert"><Fields><asp:BoundField DataField="AllocationID" HeaderText="AllocationID" ReadOnly="True" SortExpression="AllocationID" /><asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" /><asp:BoundField DataField="OriginalAlloc" HeaderText="OriginalAlloc" SortExpression="OriginalAlloc" /><asp:BoundField DataField="RevisedAlloc" HeaderText="RevisedAlloc" SortExpression="RevisedAlloc" /><asp:BoundField DataField="Balance" HeaderText="Balance" SortExpression="Balance" /><asp:TemplateField HeaderText="ProjectNum" SortExpression="ProjectNum"><InsertItemTemplate><asp:EntityDataSource ID="ProjAllocDDLEntityDataSource" runat="server" ConnectionString="name=DPEntities" DefaultContainerName="DPEntities" EnableFlattening="False" EntitySetName="ProjectInfoes" EntityTypeFilter="ProjectInfo" EnableDelete="True"></asp:EntityDataSource><asp:DropDownList ID="ProjInfoesDropDownList2" runat="server" DataSourceID="ProjAllocDDLEntityDataSource" DataTextField="ProjectNum" DataValueField="ProjectNum" OnInit="ProjInfoesDropDownList2_Init"></asp:DropDownList></InsertItemTemplate></asp:TemplateField><asp:CommandField ShowInsertButton="True" /></Fields></asp:DetailsView></Content></asp:AccordionPane><asp:AccordionPane ID="AccordionPane4" runat="server"><Header><h2>Add a Loan</h2></Header><Content><%-- LOAN --%><%-- LOAN --%><%-- LOAN --%><br /><h2>Add a Loan</h2><asp:EntityDataSource ID="LoanEntityDataSource" runat="server" ContextTypeName="MOSDP.DAL.DPEntities" EnableFlattening="False" EntitySetName="Loans" Where="it.ProjectNum = @ProjectNum" ConnectionString="name=DPEntities" DefaultContainerName="DPEntities" EnableInsert="True"><WhereParameters><asp:ControlParameter ControlID="ProjInfoGridView" Name="ProjectNum" PropertyName="SelectedValue" Type="Int32" /></WhereParameters></asp:EntityDataSource><br /><asp:GridView ID="LoanGridView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="LoanID" DataSourceID="LoanEntityDataSource"><Columns><asp:BoundField DataField="LoanID" HeaderText="LoanID" ReadOnly="True" SortExpression="LoanID" /><asp:BoundField DataField="Institution" HeaderText="Institution" SortExpression="Institution" /><asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount" /><asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" /><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" SortExpression="ProjectNum" /></Columns><EmptyDataTemplate> There are no records in this list.</EmptyDataTemplate></asp:GridView><br /><asp:DetailsView ID="LoanDetailsView" runat="server" Height="50px" Width="125px" DefaultMode="Insert" AutoGenerateRows="False" DataKeyNames="LoanID" DataSourceID="LoanEntityDataSource"><Fields><asp:BoundField DataField="LoanID" HeaderText="LoanID" ReadOnly="True" SortExpression="LoanID" /><asp:BoundField DataField="Institution" HeaderText="Institution" SortExpression="Institution" /><asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount" /><asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" /><asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" SortExpression="ProjectNum" /><asp:CommandField ShowInsertButton="True" /></Fields></asp:DetailsView></Content></asp:AccordionPane></Panes></asp:Accordion></asp:Content>
Thanks in advance.