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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:05:20+00:00 2026-05-23T12:05:20+00:00

I have a DropDownList that is populated from a datasource. After it is bound,

  • 0

I have a DropDownList that is populated from a datasource. After it is bound, I place an empty field at the top of the list so that it appears blank to the user (creating a sort of ‘default item’). I have some code behind handling the SelectedIndexChanged event, but it doesn’t really need to be executed if the user were to select the empty ListItem.

Here is my code:

.aspx

<asp:DropDownList ID="dropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropDownList_SelectedIndexChanged">
</asp:DropDownList>  

C# Codebehind adding the blank ListItem

dropDownList.Items.Insert(0, new ListItem(String.Empty, String.Empty));
dropDownList.SelectedIndex = 0;

Since I don’t need the page to do a postback when the user clicks just this specific index, I want to disable postback entirely for just this listitem. Is this even possible? If so, how?

  • 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-23T12:05:21+00:00Added an answer on May 23, 2026 at 12:05 pm

    Set disabled="disabled", this will make the item not selectable (and not do postback)

    <asp:DropDownList runat="server" ID="dddl">
        <asp:ListItem Text="" disabled="disabled" Selected="True"></asp:ListItem>
        <asp:ListItem Text="test"></asp:ListItem>
    </asp:DropDownList>
    

    Alternatively if you want to be able to select the first (empty) item but not do postback, do this:

    <asp:DropDownList runat="server" ID="dddl" AutoPostBack="true" onchange="if(this.selectedIndex == 0)return false;">
        <asp:ListItem Text="" Selected="True"></asp:ListItem>
        <asp:ListItem Text="test"></asp:ListItem>
    </asp:DropDownList>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dropdown list that is currently populated from a result set of
I have a dropdown list that stores name/value pairs. The dropdown appears in each
my dropdownlist is populated from the database as in: DataTable dt = GetData(); ddlMylist.DataSource
I have a bound dropdown list populated with a table of names through a
I have a drop down list that is populated in the page load event
I have an ASP.NET DropDownList control that renders into a dropdown list (select HTML
I have a DropDownList that is associated with a DataSource in the aspx page.
If I have a DropDownList control that makes up part of a CompositeControl how
I have a CompositeControl that contains a DropDownList. I have set the AutoPostBack property
I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl(locale)).SelectedValue; HttpCookie

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.