如何用另一个DDL填充下拉列表 [英] How to populate a dropdown list with another ddl

查看:82
本文介绍了如何用另一个DDL填充下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用选定的值用另一个下拉列表填充一个下拉列表,我尝试了以下代码,但它使用业务逻辑填充了ddl.

how do i populate a dropdownlist with another dropdownlist list using a selected value, i tried the following code but it populates the ddl with business logic.

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
     {
            Service obj = new Service ();
            List <Service > slist = new List<Service> ();
            Int32 ser = Convert .ToInt32  (DropDownList2.SelectedValue);
            slist = obj.allServcieBYfk(ser);
            drpDwnService.DataSource = slist;
            
            drpDwnService.DataBind();
        }

推荐答案

,但它使用业务逻辑填充ddl"

"but it populates the ddl with business logic"

slist = obj.allServcieBYfk(ser);
drpDwnService.DataSource = slist;



是的,这正是您要它执行的操作.

您希望发生什么事?



Yes, that is doing exactly what it is you are asking it to do.

What is it you expect to happen?


马克说的没错,不清楚是怎么回事?欲了解更多信息,请参阅以下

级联DropDownList根据ASP.NET中其他下拉菜单的选择填充下拉菜单 [^ ]
CascadingDropDown [
Mark is right, Not clear what''s the matter? For further reading see these

Cascading DropDownList Populate dropdown based on selection of other dropdown in ASP.NET[^]
CascadingDropDown[^]


这篇关于如何用另一个DDL填充下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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