Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Could not find control '' in ControlParameter ''.

Posted on 2006-06-13
4
Medium Priority
?
2,676 Views
Last Modified: 2012-05-05
I am getting the error above when trying to reference a drop down list in a gridview, edititemtemplate section.

Here is the gridview containing the template
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="LocationsObjds"
                DataKeyNames="LocationID,LocationCategoryID" Width="782px" OnRowCommand="GridView1_RowCommand"
                OnRowUpdating="GridView1_RowUpdating">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                    <asp:BoundField DataField="LocationID" HeaderText="LocationID" SortExpression="LocationID"
                        ReadOnly="True" Visible="False" />
                    <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
                    <asp:BoundField DataField="AddressIdentifier" HeaderText="AddressIdentifier" SortExpression="AddressIdentifier" />
                    <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
                    <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
                    <asp:BoundField DataField="County" HeaderText="County" SortExpression="County" />
                    <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
                    <asp:BoundField DataField="ZipCode" HeaderText="ZipCode" SortExpression="ZipCode" />
                    <asp:BoundField DataField="LocationCategoryID" HeaderText="LocationCategoryID" SortExpression="LocationCategoryID"
                        Visible="False" />
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <asp:Label ID="lblLocationType" runat="server" Text='<%# Eval("LocationCategoryDescription") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="ddlLocationCategory" runat="server" DataSourceID="LocationCategoryObjds"
                                DataTextField="LocationCategoryDescription" DataValueField="LocationCategoryID">
                            </asp:DropDownList>
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

and the datasource attempting to use its value
        <asp:ObjectDataSource ID="LocationsObjds" runat="server" DeleteMethod="DeleteForVendor"
            InsertMethod="InsertForVendor" SelectMethod="GetByVendorIDFromVendorLocations"
            TypeName="VendorManagement.BusinessLogicLayer.BLLWsLocationsProvider" UpdateMethod="Update"
            OldValuesParameterFormatString="original_{0}">
            <SelectParameters>
                <asp:SessionParameter Name="vendorID" SessionField="VendorID" Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:SessionParameter Name="VendorID" SessionField="VendorID" Type="Int32" />
                <asp:Parameter Name="entity" Type="Object" />
            </InsertParameters>
            <DeleteParameters>
                <asp:SessionParameter Name="VendorID" SessionField="VendorID" Type="Int32" />
                <asp:Parameter Name="LocationID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="LocationID" Type="Int32" />
                <asp:Parameter Name="Address" Type="String" />
                <asp:Parameter Name="AddressIdentifier" Type="String" />
                <asp:Parameter Name="City" Type="String" />
                <asp:Parameter Name="State" Type="String" />
                <asp:Parameter Name="County" Type="String" />
                <asp:Parameter Name="ZipCode" Type="Int32" />
                <asp:Parameter Name="Country" Type="String" />
                <asp:ControlParameter ControlID="GridView1$ddlLocationCategory" Name="LocationCategoryID"
                    PropertyName="SelectedValue" Type="Int32" />
            </UpdateParameters>
        </asp:ObjectDataSource>

Note:
The controlID is set to "GridView1$ddlLocationCategory". I originally used "ddlLocationCategory" but it was recommended to use the control container name followed by a $ then the control name. I have heard this work for a number of people but it isn't happening for me.

Thoughts?
0
Comment
Question by:jason_lewis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Expert Comment

by:existenz2
ID: 16900739
You need to iterate through the gridview items and then use FindControl("ddlLocationCategory"), that should work.
0
 
LVL 1

Author Comment

by:jason_lewis
ID: 16912569
I was attempting to do this only with the wizards and not have to right code.



0
 
LVL 1

Accepted Solution

by:
uiey earned 2000 total points
ID: 16912684
You need to edit the template (edit item or insert item template), and add a drop down to your template.
Set the data-source of that drop-down to the lookup values table, retrieving all of the rows. Make sure the display is the the column you need shown in the drop down, and the value is the Fkey to the base table.
Set the data-bindings so that it starts with the value(FKey) from the base table, and make it 2 way.

You now have a drop down in your grid/details view that displays the contents of a lookup table for edit/insert only, and updates the correct key to your database.
0
 
LVL 1

Author Comment

by:jason_lewis
ID: 16915631
That works, thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question