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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:16:30+00:00 2026-05-31T05:16:30+00:00

I am trying to make a dropdownlist work for me. A user can be

  • 0

I am trying to make a dropdownlist work for me. A user can be in many ‘Field1’s, so I wanted the dropdown to show those Field1s.
Currently what happens is I just get a blank list. Here is a sample of the code:

 <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" 
                    SelectCommand="SELECT DISTINCT Field1 FROM table 
                                    WHERE (Field3= @Field3)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" Name="Field3" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>

If I remove the select parameters and the WHERE clause the list of all DHBs appears – it just seems to have issues with @Field3.

Edit: I have tested the query in SQL Server and it works for me (by replacing @Field3 with a known value)

Any suggestions? I am very new to asp.net, and have next to nothing in the .cs file (besides some authorisation and such), so if people could point me in the right direction that would be fantastic.

Edit 2: It would probably help if I gave you the whole template:

 <asp:TemplateField HeaderText="Field1" SortExpression="Field2">
            <EditItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("Field2") %>'></asp:Label>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:DropDownList ID="DropDownList1" runat="server" 
                    DataSourceID="SqlDataSource2" DataTextField="Field1" DataValueField="Field1">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" 
                    SelectCommand="Field1 FROM table 
                                    WHERE (Field3 = @Field3)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" Name="Field3" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </ItemTemplate>
        </asp:TemplateField>
  • 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-31T05:16:30+00:00Added an answer on May 31, 2026 at 5:16 am

    You’re populating another control using Dropdownlist selectedValue as a parameter, that is dictated by your code. In this case
    You’re missing property in the controlParameter

    <SelectParameters>
         <asp:ControlParameter ControlID="DropDownList1" Property="SelectedValue" Name="Field3" Type="String" />
    </SelectParameters>
    

    If you’re trying to populate DropDownList1 you’re completely derailed. In this case you need to show up more markup code and details.

    Update: You cannot take the parameters value from the DropDownList control which you’re populating. Either remove the parameter or use another control to provide the value

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to make a DropDownList work in my trivial app. I
Trying to make a make generic select control that I can dynamically add elements
im trying make one replace in string from a array but this dont work
i am trying to make a colored dropdown list with colored items (please see
Hello I am trying to make a mostly CSS dropdown with some jQuery handling
Trying to make a canvas effect work in IE8. With excanvas.js there is no
I am trying make long screen to vertical direction. So, I need a screen
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a generic PL/SQL procedure to export data in specific XML format,
Trying to make a web service call to an HTTPS endpoint in my Silverlight

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.