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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:27:48+00:00 2026-05-28T03:27:48+00:00

I have 14 Dropdownlist accroding to 7 Days. Like For a day First dropdown

  • 0

I have 14 Dropdownlist accroding to 7 Days.
Like For a day First dropdown list is Named as From-Time and Second Dropdown list is To-Time.
List Values are Set by 30 minutes Time Difference.
To-Time dropdownlist Should save only those list items which fall after From-time Dropdownlist.like if i select 1 Pm by first then second dropdown list should carry list-items after 1 Pm.
removing is done like this..

 protected void ddlMonst_SelectedIndexChanged(object sender, EventArgs e)
        {
            RemoveListItem(sender as DropDownList,checkboxes);
        }
        private void RemoveListItem(DropDownList DDl,DropDownList[] checkboxes)
        {
            int CurrrentSelectedIndex = DDl.SelectedIndex;
            String StartDDlName = DDl.ID.Substring(3, 3).ToString() + "ed";
           String TargetedDDlName = string.Empty;
            for (int i = 0; i < checkboxes.Length; i++)
            {
                TargetedDDlName = checkboxes[i].ID.Substring(3, 5).ToString() ;
                if (StartDDlName.Equals(TargetedDDlName))
                {
                    for(int j=0 ;j<CurrrentSelectedIndex;j++)
                    checkboxes[i].Items.RemoveAt(0);
                }

            }

        }

but this logic fails if i selected again and again from First Dropdown list.It reomoves all from second one.

How to Handle this situation

  • 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-28T03:27:48+00:00Added an answer on May 28, 2026 at 3:27 am

    Assuming your code is successfully removing the Items, then it makes sense that the To-Time DropDowns could end up being empty after multiple successive selects from the From-Time DropDown(s).

    Instead of using .RemoveAt(), you could .Clear() your To-Time DropDowns and then .Add() the Items from the From-Time DropDown from its SelectedIndex and onwards.

        // ...
        // get reference to To/From DropDown(s) here
        // ...
        dd_time_to.Items.Clear();
        for (int i = dd_time_from.SelectedIndex; i < dd_time_from.Items.Count; i++)
        {
            dd_time_to.Items.Add(dd_time_from.Items[i]);
        }
    

    You’ll have to modify this to work on your DropDownList[]

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

Sidebar

Related Questions

I have a dropdownlist in a page. The values of all the list items
I have dropdownlist,which get filled from table1.That table1 has Zero value.While filling the dropdown,want
I have a dropdownlist (cboViewAlbums) which has displays album values. The first item is
I have a dropdownlist dynamically filled from file folder and the dropdown filled with
I have DropDownList with CascadingDropDown extender. If I want to retrieve data from the
I have a dropdownlist with the autopostback set to true. I want the user
I have DropDownList inside GridView. Now I would like to add event handler for
I have one dropdownlist in my c# code behind page like `DropDownList dl =
i have dropdownlist with the values: <select id=myddl name=myddl> <option value=1>One</option> <option value=2>Twooo</option> <option
I have dropdownlist and set autopostback Property to true.. the problem is that i

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.