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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:44:46+00:00 2026-06-03T15:44:46+00:00

I have a 3 dropdownlist control with a selectedindexchanged event that fires correctly. However,

  • 0

I have a 3 dropdownlist control with a selectedindexchanged event that fires correctly. However, when you select an item from the list the index value that is returned to the selectedindexchanged event does not change; the list box pops back to the first item in the list. Any help would be appreciated. ~Dharmendra~

`public partial class Production : System.Web.UI.Page
{ 
    EmployeeQuotientCL.Production _production = null;
    DataSet dsNatureOfWork = new DataSet();
    DataSet dsProjectRegion = new DataSet();
    DataSet dsCountyDetails = new DataSet();
    DataSet dsWorkType = new DataSet();
    DataSet dsTask = new DataSet();


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
             string userEcode=Convert.ToString(Session["UserID"]); 
            _production = new EmployeeQuotientCL.Production();                       
            dsNatureOfWork = _production.GetNatureOfWork();
            if (dsNatureOfWork.Tables[0].Rows.Count > 0)
            {
                BindDdlNatureOfWork(dsNatureOfWork);
            }
            else
            {
            }
        }            

    }



    public void BindDdlNatureOfWork(DataSet dsNatureOfWork)
    {
        ddlNatureofWork.DataSource = dsNatureOfWork.Tables[0];
        ddlNatureofWork.DataTextField = "NatureOfWorkName";
        ddlNatureofWork.DataValueField = "NatureOfWorkID";
        ddlNatureofWork.DataBind();
        ddlNatureofWork.Items.Insert(0, "--Select Nature of Work--");
    }

    public void FillRegionProject(int NatureOfWorkID)
    {
        if ((NatureOfWorkID != null) || (NatureOfWorkID != 0))
        {
            _production = new EmployeeQuotientCL.Production();
            dsProjectRegion = _production.GetProjectRegion(NatureOfWorkID);
            if (dsProjectRegion.Tables[0].Rows.Count > 0)
            {
                ddlRegionProjectName.DataSource = dsProjectRegion.Tables[0];
                ddlRegionProjectName.DataTextField = "RegionProjectName";
                ddlRegionProjectName.DataValueField = "RegionProjectID";
                ddlRegionProjectName.DataBind();
                ddlRegionProjectName.Items.Insert(0, "--Select Region/Project--");

            }
            else
            {
            }
        }

    }

    protected void ddlRegionProjectName_SelectedIndexChanged(object sender, EventArgs e)
    {
        int RegionProjectID = Convert.ToInt32(ddlRegionProjectName.SelectedValue.ToString());
        FillCounty(RegionProjectID);
        ddlRegionProjectName.SelectedIndex = 0;

    }

    public void FillCounty(int regionprojectID)
    {
        if ((regionprojectID != null) || (regionprojectID != 0))
        {
            _production = new EmployeeQuotientCL.Production();
            dsCountyDetails = _production.GetCounty(regionprojectID);
            if (dsCountyDetails.Tables[0].Rows.Count > 0)
            {
                ddlCountyName.DataSource = dsCountyDetails.Tables[0];
                ddlCountyName.DataTextField = "CountyName";
                ddlCountyName.DataValueField = "CountyID";
                ddlCountyName.DataBind();
                ddlCountyName.Items.Insert(0, "--Select County--");

            }
            else
            {
            }
        }
    }

    protected void ddlNatureofWork_SelectedIndexChanged(object sender, EventArgs e)
    {
        int NowID = Convert.ToInt32(ddlNatureofWork.SelectedValue.ToString());
        FillRegionProject(NowID);
        ddlRegionProjectName.SelectedIndex = 0;
    }

}

}`

  • 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-03T15:44:49+00:00Added an answer on June 3, 2026 at 3:44 pm

    You are doing ddlRegionProjectName.SelectedIndex = 0; in every SelectedIndexChanged event.

    You have no event for ddlCountyName control in the code shared by you.

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

Sidebar

Related Questions

I have an ASP.NET DropDownList control that retrieves the first and last name from
I have a dropdownlist control in a datagrid template field. In the SelectedIndexChanged event,
I have a DropDownList inside a repeater control in an ASP.NET page that has
I have created a customer c# DropDownList control that can render out it's contents
If I have a DropDownList control that makes up part of a CompositeControl how
I have a dropdownlist (on Page) which has OnSelectedIndexChange event thats Loads different Control
I need to dynamically add CheckBoxList on the SelectedIndexChanged event of DropDownList. I have
I have a DropDownList control that is populated via server side. I use a
I have asp:DropDownList control which i want to display data to user who don't
I have a dropdownlist. A column called id has the control dropdownlist ( I've

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.