Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:39:26+00:00 2026-06-17T12:39:26+00:00

Using 2 dropDownLists in repeater row how does one use the 1st one as

  • 0

Using 2 dropDownLists in repeater row how does one use the 1st one as a filter for 2nd?

The repeater layout is simple: [category_dropDown][item_dropDown][add_button]

The problem is that I can’t connect two dropDown controls. SqlDataSource ControlParameter cannot find ControlID to call (controls renamed by repeater). Changing ControlID value to “itemRepeater$dropDownCategory” obviously doesn’t help. How do I bind these dropDowns to work in pairs?

Wondering mostly if there is a markup code solution, since code-behind solution will be easier to implement.

<asp:Repeater ID="itemRepeater" runat="server" OnItemCommand="itemRepeater_ItemCommand" onitemdatabound="itemRepeater_ItemDataBound">
    <HeaderTemplate>
        <table>
        <tr>
            <td>Category</td>
            <td>Item</td>
            <td></td>
        </tr>
    </HeaderTemplate>
    <ItemTemplate>        
        <tr>
            <td><asp:DropDownList ID="dropDownCategory" runat="server" DataSourceID="SqlDataSourceCategory" DataTextField="Category" 
                DataValueField="ID_cat" SelectedValue='<%# DataBinder.Eval(Container.DataItem,"Category") %>' AppendDataBoundItems="true">                    
                <asp:ListItem Value="%" Text="Pick category" Selected="True" />
                </asp:DropDownList></td>
            <td><asp:DropDownList ID="dropDownItem" runat="server" DataSourceID="SqlDataSourceItem" DataTextField="Item" 
                DataValueField="ID_item" SelectedValue='<%# DataBinder.Eval(Container.DataItem,"Item") %>' AppendDataBoundItems="true">
                <asp:ListItem Value="%" Text="Pick item" Selected="True"  />
                </asp:DropDownList></td>   
            <td><asp:Button ID="repeatedButton" runat="server" CommandName='<%# DataBinder.Eval(Container.DataItem, "Button") %>' Text='<%# DataBinder.Eval(Container.DataItem, "Button") %>' /></td>             
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>


<asp:SqlDataSource ID="SqlDataSourceCategory" runat="server" ConnectionString="..." 
    SelectCommand="SELECT [Category], [ID_cat] FROM [Categories]">
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSourceItems" runat="server" ConnectionString="..." 
    SelectCommand="SELECT [ID_item],[Item] FROM [Items]"  FilterExpression="WHERE [ID_cat] = @ID_cat" >
    <FilterParameters>
        <asp:ControlParameter Name="ID_cat" ControlID="dropDownCategory" PropertyName="SelectedValue" />
    </FilterParameters>
</asp:SqlDataSource>    

The ControlID binding above is obviously wrong, because SqlDataSourceItems can’t find ControlID called “dropDownCategory” in ItemTemplate and throws known exception: Could not find control ‘dropDownCategory’ in ControlParameter ‘ID_cat’

Thanks in advance for any advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:39:27+00:00Added an answer on June 17, 2026 at 12:39 pm

    Hi following link will give you the trick:

    Solution 1

    Solution 2

    e.g: Something like this:

     DropDownList ddlcity = (DropDownList)grow.FindControl("ddlcity"); // To get the value of dropdown
    
            cmd.Parameters.Add("@city", ddlcity.SelectedItem.ToString());  // This will add selected item to database
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET to build a form which has 3 DropDownLists and one GridView.
I have two dropdownlists and I am filling one based on the other using
I am using Asp.net dropdownlist in one of my form ..I have two dropdown
I have 2 dropdown lists on my webform and using jquery trying to filter/reset
I'm using a repeater ListOfArticles and have controls inside it like ddlSizes and btnSelectArticle
I'm trying to use FindControl() to SET the values of some DropDownLists on a
I'm using a EntityDataSource with WhereParameters binded from DropDownLists. The Where Clause may be
I am using spark DropDownLists and I don't want to see any horizontal scrollbars
I have multiple user controls loading asynchronously on my page, using pagemethods. Some dropdownlists
I am using Linq To Sql to populate Html.DropDownLists in a few different forms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.