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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:15:24+00:00 2026-05-12T00:15:24+00:00

i have a small problem, i am creating a edit page in my asp.net

  • 0

i have a small problem, i am creating a edit page in my asp.net application where the user can edit properties in an object. I have two dropdowns (category and group) where the amount of groups is dependent on the category chosen. My goal is to display the right category og the object being edited, then load the list of groups and select the correct group – problem is that my selectedindexchanged event is never fired.

When i load my categories in page_load and populate the categories the code looks like this:

protected void Page_Load(object sender, EventArgs e)
    { string editid= Request["edit"] == null ? null : Request["edit"].ToString();
        int id = Convert.ToInt32(editid);
        if (link == null)
        {
            link = BLLink.Load(id, blm);
        }
        if (!IsPostBack)
        {
            group = BLGroup.Load(link.GroupId, blm);
            category = BLCategory.Load(group.CategoryId, blm);

            List<BLCategory> categories = BLCategory.LoadAll();
            categoryDropDown.DataSource = categories;
            categoryDropDown.DataTextField = "CategoryName";
            categoryDropDown.DataValueField = "id";
            categoryDropDown.SelectedValue = category.id.ToString(); //this one doesnt cause the event to fire??? Doesnt matter if it is called after the databind() method
            categoryDropDown.DataBind();
        }

}

Theevent handler i would like to execute should load all the groups and populate the dropdown and select the correct one:

protected void categoryDropDown_SelectedIndexChanged(object sender, EventArgs e)
    {
        category = BLCategory.Load(Convert.ToInt32(categoryDropDown.SelectedValue), new TestModelDataContext());
        if (category != null)
        {
            List<BLGroup> groups = BLGroup.LoadAll(category.id);
            groupDropDown.DataSource = groups;
            groupDropDown.DataTextField = "GroupHeading";
            groupDropDown.DataValueField = "GroupId";
            groupDropDown.DataBind();
            if (group != null)
            {
                groupDropDown.SelectedValue = group.GroupId.ToString();
            }
            else
            {
                groupDropDown.SelectedIndex = 0;
            }
        }
    }

I dont know what is going wrong, this seems like a straightforward thing to do, what am I doing wrong?

  • 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-12T00:15:25+00:00Added an answer on May 12, 2026 at 12:15 am

    To get this event to fire, the page needs to PostBack when the user’s selection changes. This will cause the entire page to refresh (but controls should retain their state).

    This SelectedIndexChanged event is running on the server and I think there is a property on the first dropdown about submitting/postback when the selected item changes on it.

    To get client-side behavior, you can do two things:
    1) Wrap that section in an UpdatePanel and have the second list refresh when the first one’s value changes
    2) Load the values using JavaScript client-side code that fires when the selected value changes on the first one, retrieves the list and fills the second one
    2a) You can either write a service that wraps the call to the data source and returns the values as JSON, etc., or
    2b) You can fill all the values for every possible choice into hidden fields that are id’d in some way by the values in the first box (this is not desirable, but is possible depending on the security and size of your data sets).

    Option 1 is probably the most straightforward way to retain your existing codebase and still get client-side behavior.

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

Sidebar

Ask A Question

Stats

  • Questions 253k
  • Answers 253k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As a workaround how about the below query.. But i… May 13, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer Take a look at this question Source code highlighting in… May 13, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer Just use digest instead of hexdigest: puts Digest::MD5.digest(encode) May 13, 2026 at 9:53 am

Related Questions

I am using reflection along with linq.Dynamic, and I am having a small problem
I'm developping a small UML Class editor in Java, mainly a personal project, it
I am writing a text renderer for an OpenGL application. Size, colour, font face,
I have a class that has a vector of another class objects as a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.