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 928927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:05:18+00:00 2026-05-15T20:05:18+00:00

I have two nested DropDownLists (the value selected in the 1st ddl will limit

  • 0

I have two nested DropDownLists (the value selected in the 1st ddl will limit the content of the 2nd ddl).

The example attached here runs fine outside of a GridView. As soon as I try to insert this into a GridView, I get an error because I cannot identify the ControlID to use in the ControlParameter.

The code outside of the GridView looks like this:

<asp:DropDownList ID="ACTION1_DROPDOWNLIST"
    AutoPostBack="true" ToolTip="Dropdown List" runat="server" CssClass="Select" 
    DataSourceID="SqlDataSource1" DataTextField="Description" DataValueField="ID" >
    <asp:ListItem Value=""></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ACTION1_DROPDOWNLIST2" 
    ToolTip="Dropdown List" runat="server" CssClass="Select" 
    DataSourceID="SqlDataSource2" DataTextField="Description" DataValueField="ID" >
    <asp:ListItem Value=""></asp:ListItem>
</asp:DropDownList>

And the DataSources look like this:

<asp:Panel ID="HiddenFields" runat="server">
    <asp:TextBox ID="DRAFT" runat="server" Visible="false"></asp:TextBox>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MyDataBase %>" 
        ProviderName="<%$ ConnectionStrings:MyDataBase.ProviderName %>" 
        SelectCommand="SELECT [ID], [Description] FROM [Items]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MyDataBase %>" 
        ProviderName="<%$ ConnectionStrings:MyDataBase.ProviderName %>" 
        SelectCommand="SELECT [ID], [Description] FROM [SubItems] WHERE [itemId]=:v_ItemId">
        <SelectParameters>
            <asp:ControlParameter Name="v_ItemId" ControlID="ACTION1_DROPDOWNLIST" PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Panel>

Thanks!

  • 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-05-15T20:05:18+00:00Added an answer on May 15, 2026 at 8:05 pm

    I have tried something similar and it works fine. I can’t tell from your post whether the data sources are together with the dropdowns inside the ItemTemplate of the GridView. At least the second one should be inside the ItemTemplate so that you will have a data source for each line in the grid.

    I have posted my page below. It’s using different tables, but it’s the same idea.

    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:DropDownList ID="ACTION1_DROPDOWNLIST" 
                            AutoPostBack="true" ToolTip="Dropdown List" runat="server" CssClass="Select"  
                            DataSourceID="SqlDataSource1" DataTextField="Surname" DataValueField="FamilyID" > 
                            <asp:ListItem Value=""></asp:ListItem> 
                        </asp:DropDownList> 
                        <asp:DropDownList ID="ACTION1_DROPDOWNLIST2"  
                            ToolTip="Dropdown List" runat="server" CssClass="Select"  
                            DataSourceID="SqlDataSource2" DataTextField="Name" DataValueField="PersonID" > 
                            <asp:ListItem Value=""></asp:ListItem> 
                        </asp:DropDownList>
                        <asp:Panel ID="HiddenFields" runat="server"> 
                            <asp:TextBox ID="DRAFT" runat="server" Visible="false"></asp:TextBox> 
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server"  
                                ConnectionString="<%$ ConnectionStrings:tunedinConnectionString %>"  
                                ProviderName="<%$ ConnectionStrings:TunedInConnectionString2.ProviderName %>"  
                                SelectCommand="SELECT * FROM [Person] WHERE ([FamilyId] = @FamilyId)"> 
                                <SelectParameters> 
                                    <asp:ControlParameter Name="FamilyId" ControlID="ACTION1_DROPDOWNLIST" 
                                        PropertyName="SelectedValue" Type="Int32" /> 
                                </SelectParameters> 
                            </asp:SqlDataSource> 
                        </asp:Panel>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server">
        </asp:LinqDataSource>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
        ConnectionString="<%$ ConnectionStrings:tunedinConnectionString %>"  
        ProviderName="<%$ ConnectionStrings:TunedInConnectionString2.ProviderName %>"  
        SelectCommand="SELECT * FROM [Family]"> 
    </asp:SqlDataSource> 
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two span tags that contain content. The first span tag will hold
What I'm talking about here are nested classes. Essentially, I have two classes that
I have two nested ajax calls to server. In 1st ajax call, server returns
Here is my situation - I have two nested view models: <%=Html.EditorFor(x => x.DisplayEntitiesWithRadioboxesViewModel)%><br
I have two nested packages that I am calling via fast_cgi. From the first
I have two nested loop in XSL like this, at this moment I use
I have two masterpages. A main.Master and a search.Master. The search.Master is a nested
I have two tables: Campaigns, Campaign_statistics. I need to output campaigns list with nested
I have a navigation bar that has two dropdowns (as nested ul's). I'm trying
I have two nested lists of different sizes: A = [[1, 7, 3, 5],

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.