转发器中的嵌套下拉列表 [英] Nested Dropdown in repeater

查看:74
本文介绍了转发器中的嵌套下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从repeater中的另一个下拉列表中检索一个下拉列表的值。但on_selectedindex下拉列表更改其他下拉列表的所有值都被重置。请给我解决方案。

我的代码onselectedindexchanged of lab dropdownlist。如果有实验室nari诊所,那么实验室部门将从转发器中的数据库中恢复,这些值与转发器中存在的所有行分开。

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.

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"));
    }
}

推荐答案

嘿那里,



这个小代码和信息很难猜到这个问题。



但我认为你在DropDownList之后绑定了你的Repeater控件selectedIndexChanged事件。

检查你的代码,看看在那个事件之后是否正在调用转发器的绑定代码。



希望它有帮助



祝你好运..



Azee ......
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...


这篇关于转发器中的嵌套下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆