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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:02:57+00:00 2026-05-12T23:02:57+00:00

well the problem is that i am trying to get DDL to: 1. Recive

  • 0

well the problem is that i am trying to get DDL to:
1. Recive catagories from a DB tabel – working
2. OnChange select from a different table the products by the item in the DDL – working
had a problem with No1 but fixed that problem. i found out that to get No1 working i have to use postback. did that and every thing in that part is working well and actualy every thing is working…but my hug problem (and i cant find any good answer for it) is that every time i change the item i a getting all the times all over again(i have initialy 8 item – secont time 16 – 24 etc….)
tried to use: ddlCatagories.Items.Clear();
when i use that i am not getting any duplicates but then, i am not getting any thing, it takes the first catagory from the list every time, no matter what i chose in the list..
trying to figure it out for the past week…please help 🙂

    public partial class selectNamesFromCatagories : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ddlCatagories.Items.Clear();
        SqlDataReader dr = DbHelper.ExecuteReader(
            sqlConn1.home,
            "spSelectNamesFromCatagories");
        while (dr.Read())
        {
            ListItem li = new ListItem(dr["CategoryName"].ToString());
            ddlCatagories.Items.Add(li);
        }
        dr.Close();
    }
    protected void ddlCatagories_SelectedIndexChanged(object sender, EventArgs e)
    {
        SqlDataReader dr = DbHelper.ExecuteReader(
                            sqlConn1.home,
                            "spProductsByCatagoryID",
                            new SqlParameter("@catName", ddlCatagories.Text)
                            );
        while (dr.Read())
        {
            TableRow tr = new TableRow();
            for (int i = 0; i < dr.FieldCount; i++)
            {
                TableCell td = new TableCell();
                td.Text = dr[i].ToString();
                tr.Controls.Add(td);
            }
            tblProductsByCatagories.Controls.Add(tr);
        }
    }
}
  • 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-12T23:02:57+00:00Added an answer on May 12, 2026 at 11:02 pm

    Only populate the DropDownList on first load by checking whether the page has not posted back ie.

    if (!Page.IsPostBack)
    {
        // Populate list
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well guys, I'm trying to get that MongoDB feature working for hours: http://www.mongodb.org/display/DOCS/Http+Interface I
well this is my problem i use 2 source first query (select * from
I am trying to get AStyle working with Vim so that I can use
It's a well known problem that executing make test doesn't build the tests as
I have the following problem that the standard library doesn't solve well, and I'm
Well, as I say in the subject, my problem is that I'm selecting programmatically
-----UPDATE----- Well, seems that the problem was in last.id . When database is created
I've implemented my own kinetic scrolling component that generally works very well. My problem
I have a mysql table with over 4 million of data; well the problem
I'm trying to get deeper into advanced-SQL'ing but have a slight problem with some

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.