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

  • Home
  • SEARCH
  • 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 8980543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:06:51+00:00 2026-06-15T20:06:51+00:00

I currently developing a webpage using C#. I have a DropdownList data bound with

  • 0

I currently developing a webpage using C#. I have a DropdownList data bound with the data from my sql database. After the dropdownlist bind with my database, the item inside the dropdownlist are userA, userB, and userC. If i select any of the item inside the dropdownlist, the data of the particular user will show in the gridview.

So, what I am trying to do now is I want to add an ALL into the dropdownlist. When I click on the ALL, the data of each user will be shown in the gridview. How can I achieve that? Any advice? Thanks.

P/S: I dont want to add any extra button in order to show all the user data. I want to make it in the dropdownlist.

This is my code:

WebApp.aspx:

<asp:DropDownList ID="DropDownList1" runat="server" 
        DataSourceID="SqlDataSource1" DataTextField="Username" 
        DataValueField="Username">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" 
        SelectCommand="SELECT [Username] FROM [Accounts]">
</asp:SqlDataSource>

This is what i have edited for a new Webpage. I do not call the data binding function in code behind.

Thanks for any helps.

This is the answer i am looking for:

<asp:DropDownList ID="DropDownList1" runat="server" 
        DataSourceID="SqlDataSource1" DataTextField="Username" 
        DataValueField="Username" AppendDataBoundItems="True">
    <asp:ListItem Text="All" Value ="all" Selected="True"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" 
        SelectCommand="SELECT [Username] FROM [Accounts]">
</asp:SqlDataSource>

Thanks everyone who is trying to help me.

  • 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-15T20:06:52+00:00Added an answer on June 15, 2026 at 8:06 pm

    You can achieve this:

    Use this code after you bind the DropdownList with SQL data

    ddlUsers.Items.Add(new ListItem("All", "all"));
    ddlUsers.SelectedValue = "all";
    

    Once this is done, you can make your select all user query based on this condition:

    if(ddlUsers.SelectedValue == "all")
    {
       // your SQL query to select all users goes here.
    }
    

    In HTML Markup you can add this like:

    <asp:DropDownList ID="DropDownList1" runat="server" 
            DataSourceID="SqlDataSource1" DataTextField="Username" 
            DataValueField="Username">
    
    <asp:ListItem Text="All" Value ="all" Selected="True"></asp:ListItem>
    
    </asp:DropDownList>
    

    You can remove Selected="True" if you don’t want this to be selected by default.

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

Sidebar

Related Questions

I am developing a webpage at http://www.knowledgenation.us and currently I have roughly 500 posts
I am currently developing a webpage where I want to use the ToggleClass function
Currently developing an application using the newest version of symfony, obtained through PEAR. This
Currently developing a PHP framework and have ran into my first problem. I need
Im currently developing an In-House Enterprise application. I will publish the app using Apple
I'm currently developing a website. Every feature works fine. However, I'm using a lot
I am currently developing a private framework for use on WebKit devices. I have
I am currently developing a webpage, and I want to add date&time to my
I'm currently developing a small webpage for a customer where i need a simple
Using ASP.Net Am New to website development Currently am developing a web pages, when

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.