You must Sign In to post a response.
  • Category: .NET

    Clearing the drop down only for inserted drop down values in database

    i have two drop downs with batches and days coming from two different tables now if i select a batch and for that batch already days are assigned the days that are assigned for that particular batch should not be displayed in drop down only for that batch and if i select another batch if those days are not assigned for this batch then those days should be displayed for this for example if batch 1 contains day 1 and day 2 saved in database then they sould not be displayed if i select batch 1 if selected batch 2 as day 1 and day 2 are not saved in database they should be displayed for day2 how can i do this
    string batchname = ddlbatchname.SelectedItem.Value.ToString();
    DataTable dt = adm.GetRecords(batchname);
    for (int i = 0; i < dt.Rows.Count; i++)
    {
    for (int j = 0; j < ddlday.Items.Count; j++)
    {
    string value = dt.Rows[i][1].ToString();
    string value1 = ddlday.Items[j].ToString();
    if (value == value1)
    {
    ddlday.Items.RemoveAt(j);
    break;
    }
    }
    }
  • #766538
    Hi,

    Your query is little bit confused, but as per my understand the query you want to get the days list based on batch selection. If that is your requirement , you need to pass batch id as input parameter and get the days list and bind those to your dropdownlist.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766548
    HI,

    Kindly provide the Table details. If you provide means i think very easy to identity us what's your exact query at all.

    Regards,
    Karunanidhi.K


  • Sign In to post your comments