Click here to Skip to main content
14,826,451 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am retrieving values of one dropdown from the other in repeater.but on_selectedindex change of dropdown all the values of other dropdown is reset.kindly provide me solution.
My code onselectedindexchanged of lab dropdownlist.If there is lab nari clinic then department under lab get retrived from database in repeater and these values are seperate for all rows present in repeater.
C#
foreach (RepeaterItem item in rptred.Items)
{
    AjaxControlToolkit.ComboBox cmbname = item.FindControl("cmbname") as  AjaxControlToolkit.ComboBox;
    AjaxControlToolkit.ComboBox cmbdepart = item.FindControl("cmbdepart") as AjaxControlToolkit.ComboBox;

    string lab = cmbname.SelectedItem.Text;
    string department = cmbdepart.SelectedItem.Text;
    if (department.ToString() == "-- Select --")
    {
        cmbdepart.DataSource = objCl.BindDepartment(lab);
        cmbdepart.DataBind();
        cmbdepart.DataTextField = "Department";
        cmbdepart.DataValueField = "Department";
        cmbdepart.DataBind();
        cmbdepart.Items.Insert(0, new ListItem("-- Select --", "0"));
    }
}
Posted
Updated 23-Sep-13 21:11pm
v3
Comments
Suresh Suthar 24-Sep-13 3:03am
   
We are not working for or under you. We are here to help you, so please don't use ASAP etc. and post question with detail and post some code to understand the scenario.
Thanks7872 24-Sep-13 3:08am
   
Make sure you have binded them properly while Page loads.It should be like
if(!IsPostBack)
{
your dropdown binding code here
}
abdul subhan mohammed 26-Apr-14 14:09pm
   
@Rohan 5*

1 solution

Hey there,

Its a little hard to guess the problem from that little code and information.

But I think you are binding your Repeater control after the DropDownList's selectedIndexChanged event.
check your code and see if the binding code for repeater is being called after/in that event.

hope it helps

Good luck..

Azee...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900