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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:04:57+00:00 2026-06-10T18:04:57+00:00

I have a following aspx:dropdown in aspx file: <asp:DropDownList ID=ddlbStatus Width=210px Height=30px CssClass=ddlb runat=server

  • 0

I have a following aspx:dropdown in aspx file:

<asp:DropDownList ID="ddlbStatus" Width="210px" Height="30px" CssClass="ddlb" 
         runat="server" onselectedindexchanged="ddlbStatus_SelectedIndexChanged" Style="text-align:left">
   <asp:ListItem Selected="True" Text="" Value="NA"> </asp:ListItem>
   <asp:ListItem Text="New" Value="NEW"></asp:ListItem>
   <asp:ListItem Text="Open" Value="OPEN"></asp:ListItem>
   <asp:ListItem Text="Closed" Value="CLSD"></asp:ListItem>
</asp:DropDownList>

I want to populate it from my c# file. I tried it with the following code but it didn’t work for me:

 ddlbStatus.SelectedItem = r["OrderPeriodStatus"].ToString();

For example r["OrderPeriodStatus"].ToString(); prints NEW or OPEN or CLOSED

I am newbie in asp.net. What i am doing wrong?

Updated

I have already three text present in dropdwonlist. Now what i want , I fetch the status from a SQL Query, and that value will be NEW CLOSED or OPEN. So, for example if i get the CLOSED value from database then in my HTML page CLOSED will be in selected region.

  • 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-10T18:04:58+00:00Added an answer on June 10, 2026 at 6:04 pm

    You can fill or populate your Dropdownlist in C# in this manner

    ddlbStatus.Items.Add(r["OrderPeriodStatus"]);
    

    EDIT:

    ddlbStatus.SelectedIndex = ddlbStatus.Items.IndexOf(ddlbStatus.Items.FindByText(r["OrderPeriodStatus"].ToString()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a follow dropdown list in my aspx page: <asp:DropDownList ID=OrderPeriodStatus runat=server AutoPostBack=true
On an aspx page I have following hyperlink: <asp:HyperLink ID=HyperLink1 runat=server NavigateUrl=#Bottom CssClass=ToBottom>To Bottom
I have the following drop down list: <asp:DropDownList runat=server ID=ddlShipping CssClass=shippingMenu AutoPostBack=true> <asp:ListItem Text=3-5
I have the following aspx: <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False BorderStyle=None Font-Names=Verdana Font-Size=12px OnSelectedIndexChanged=GridView1_SelectedIndexChanged ShowHeader=False
I have the following multiview set up in my aspx page: <asp:MultiView id=MultiView1 runat=server
I have the following ASPX code: <asp:ScriptManager ID=ScriptManager1 runat=server /> <asp:UpdatePanel runat=server ID=UpdatePanel UpdateMode=Conditional>
I have the following markup / code block in the ASPX file. The binding
I have the following inide my Page_Load on an aspx.cs file: public abstract partial
I have an ASP.NET web site with something similar to the following code: .aspx
In my PrinterPackage. aspx file i have the following 'User Control' : <%@ Register

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.