NickMalloy
Programmer
I have the following code that has a dropdownlist in the detailsview. When I click update I get this
Could not find control 'drpTime' in ControlParameter 'startTimeDisplay'.
<code>
<aspetailsView ID="Detail1" runat="server" DataSourceID="ObjectDataSource3" Width="350px"
AutoGenerateRows="False" HeaderText="Press Release" DataKeyNames="ID">
<Fields>
<asp:BoundField ReadOnly="True" InsertVisible="False" HeaderText="ID" DataField="ID" />
<asp:BoundField HeaderText="title" DataField="title" />
<asp:BoundField HeaderText="Press URL" DataField="url" />
<asp:TemplateField>
<HeaderTemplate>
Keywords
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="keywordDisplay" runat="server" Text='<%#Bind("keywords") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtkeywords" runat="server" Text='<%#Bind("keywords") %>' TextMode="multiLine"
Rows="5" Columns="35"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Start Date" DataField="startDate" />
<asp:TemplateField>
<HeaderTemplate>
Start Time
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="StartTimeDisplay" runat="server" Text='<%#Bind("startTime") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
Current Start Time:
<asp:Label ID="tmpStartTime" runat="server" Text='<%#Bind("startTime") %>'></asp:Label>
<aspropDownList ID="drpTime" runat="server" SelectedValue='<%#Bind("startTimeDisplay") %>'>
<asp:ListItem Text="1" Value="1:00"></asp:ListItem>
<asp:ListItem Text="2" Value="2:00"></asp:ListItem>
<asp:ListItem Text="3" Value="3:00"></asp:ListItem>
<asp:ListItem Text="4" Value="4:00"></asp:ListItem>
<asp:ListItem Text="5" Value="5:00"></asp:ListItem>
<asp:ListItem Text="6" Value="6:00"></asp:ListItem>
<asp:ListItem Text="7" Value="7:00"></asp:ListItem>
<asp:ListItem Text="8" Value="8:00"></asp:ListItem>
<asp:ListItem Text="9" Value="9:00"></asp:ListItem>
<asp:ListItem Text="10" Value="10:00"></asp:ListItem>
<asp:ListItem Text="11" Value="11:00"></asp:ListItem>
<asp:ListItem Text="12" Value="12:00"></asp:ListItem>
</aspropDownList>
<aspropDownList ID="drpTimeFrame" runat="server" SelectedValue='<%#Bind("AMPM") %>'>
<asp:ListItem Text="AM" Value="AM"></asp:ListItem>
<asp:ListItem Text="PM" Value="PM"></asp:ListItem>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="End Date" DataField="endDate" />
<asp:CheckBoxField DataField="archived" HeaderText="Not Visible" SortExpression="archived" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</aspetailsView>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="getDV"
UpdateMethod="SaveDataView" FilterExpression="ID='{0}'" TypeName="clsPressRoom">
<SelectParameters>
<asparameter Name="Columns" Type="String" DefaultValue="ID,title,url,keywords,convert(varchar,startDate,101) as startdate, LTRIM(SUBSTRING(CONVERT(varChar, startDate, 100), 12, 8)) AS startTime , convert(varchar,endDate,101) as endDate,archived,entity, CASE WHEN DATEPART(Hh, startDate) < 12 THEN 'AM' ELSE 'PM' END AS AMPM, LTRIM(SUBSTRING(CONVERT(varChar, startDate, 100), 12, 6)) AS startTimeDisplay" />
<asparameter Name="Where" Type="String" DefaultValue="GETDATE() BETWEEN startDate AND endDate" />
<asparameter Name="OrderBy" Type="String" DefaultValue="ID" />
<asparameter Name="Direction" Type="String" DefaultValue="DESC" />
<asp:ControlParameter Name="Search" ControlID="txtsearch" />
</SelectParameters>
<FilterParameters>
<asp:ControlParameter Name="singleID" ControlID="GridView1" PropertyName="SelectedValue" />
</FilterParameters>
<UpdateParameters>
<asparameter Name="ID" Type="string" />
<asparameter Name="title" Type="string" />
<asparameter Name="url" Type="string" />
<asp:FormParameter FormField="txtkeywords" Type="string" Name="keywords" />
<asparameter Name="startDate" Type="dateTime" />
<asp:ControlParameter ControlID="drpTime" Type="dateTime" Name="startTimeDisplay"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="drpTimeFrame" Type="string" Name="AMPM" PropertyName="SelectedValue" />
<asparameter Name="endDate" Type="dateTime" />
<asparameter Name="archived" Type="Boolean" />
</UpdateParameters>
</asp:ObjectDataSource>
</code>
Could not find control 'drpTime' in ControlParameter 'startTimeDisplay'.
<code>
<aspetailsView ID="Detail1" runat="server" DataSourceID="ObjectDataSource3" Width="350px"
AutoGenerateRows="False" HeaderText="Press Release" DataKeyNames="ID">
<Fields>
<asp:BoundField ReadOnly="True" InsertVisible="False" HeaderText="ID" DataField="ID" />
<asp:BoundField HeaderText="title" DataField="title" />
<asp:BoundField HeaderText="Press URL" DataField="url" />
<asp:TemplateField>
<HeaderTemplate>
Keywords
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="keywordDisplay" runat="server" Text='<%#Bind("keywords") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtkeywords" runat="server" Text='<%#Bind("keywords") %>' TextMode="multiLine"
Rows="5" Columns="35"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Start Date" DataField="startDate" />
<asp:TemplateField>
<HeaderTemplate>
Start Time
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="StartTimeDisplay" runat="server" Text='<%#Bind("startTime") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
Current Start Time:
<asp:Label ID="tmpStartTime" runat="server" Text='<%#Bind("startTime") %>'></asp:Label>
<aspropDownList ID="drpTime" runat="server" SelectedValue='<%#Bind("startTimeDisplay") %>'>
<asp:ListItem Text="1" Value="1:00"></asp:ListItem>
<asp:ListItem Text="2" Value="2:00"></asp:ListItem>
<asp:ListItem Text="3" Value="3:00"></asp:ListItem>
<asp:ListItem Text="4" Value="4:00"></asp:ListItem>
<asp:ListItem Text="5" Value="5:00"></asp:ListItem>
<asp:ListItem Text="6" Value="6:00"></asp:ListItem>
<asp:ListItem Text="7" Value="7:00"></asp:ListItem>
<asp:ListItem Text="8" Value="8:00"></asp:ListItem>
<asp:ListItem Text="9" Value="9:00"></asp:ListItem>
<asp:ListItem Text="10" Value="10:00"></asp:ListItem>
<asp:ListItem Text="11" Value="11:00"></asp:ListItem>
<asp:ListItem Text="12" Value="12:00"></asp:ListItem>
</aspropDownList>
<aspropDownList ID="drpTimeFrame" runat="server" SelectedValue='<%#Bind("AMPM") %>'>
<asp:ListItem Text="AM" Value="AM"></asp:ListItem>
<asp:ListItem Text="PM" Value="PM"></asp:ListItem>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="End Date" DataField="endDate" />
<asp:CheckBoxField DataField="archived" HeaderText="Not Visible" SortExpression="archived" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</aspetailsView>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="getDV"
UpdateMethod="SaveDataView" FilterExpression="ID='{0}'" TypeName="clsPressRoom">
<SelectParameters>
<asparameter Name="Columns" Type="String" DefaultValue="ID,title,url,keywords,convert(varchar,startDate,101) as startdate, LTRIM(SUBSTRING(CONVERT(varChar, startDate, 100), 12, 8)) AS startTime , convert(varchar,endDate,101) as endDate,archived,entity, CASE WHEN DATEPART(Hh, startDate) < 12 THEN 'AM' ELSE 'PM' END AS AMPM, LTRIM(SUBSTRING(CONVERT(varChar, startDate, 100), 12, 6)) AS startTimeDisplay" />
<asparameter Name="Where" Type="String" DefaultValue="GETDATE() BETWEEN startDate AND endDate" />
<asparameter Name="OrderBy" Type="String" DefaultValue="ID" />
<asparameter Name="Direction" Type="String" DefaultValue="DESC" />
<asp:ControlParameter Name="Search" ControlID="txtsearch" />
</SelectParameters>
<FilterParameters>
<asp:ControlParameter Name="singleID" ControlID="GridView1" PropertyName="SelectedValue" />
</FilterParameters>
<UpdateParameters>
<asparameter Name="ID" Type="string" />
<asparameter Name="title" Type="string" />
<asparameter Name="url" Type="string" />
<asp:FormParameter FormField="txtkeywords" Type="string" Name="keywords" />
<asparameter Name="startDate" Type="dateTime" />
<asp:ControlParameter ControlID="drpTime" Type="dateTime" Name="startTimeDisplay"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="drpTimeFrame" Type="string" Name="AMPM" PropertyName="SelectedValue" />
<asparameter Name="endDate" Type="dateTime" />
<asparameter Name="archived" Type="Boolean" />
</UpdateParameters>
</asp:ObjectDataSource>
</code>