如何显示特定条件的下拉列表项? [英] how to display drop down list item for a certain condition ?

查看:68
本文介绍了如何显示特定条件的下拉列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,美好的一天。我正在使用vb.net



这是我的下拉列表:



 <   asp:DropDownList     ID   =  ddl1    runat   = 服务器 >  
< asp:ListItem = > < / asp:ListItem >
< asp:ListItem = 1 > < / asp:ListItem >
< asp:ListItem = 2 > < / asp:ListItem >
< asp:ListItem = 3 > < / asp:ListItem >
< asp:ListItem = 4 > < / asp:ListItem >
< asp:ListItem = 5 > < / asp:ListItem >
< / asp:DropDownList >







我想做这样的事情



if textbox1.text =abc然后



ddl1.selectedvalue =1=可见

ddl1.selectedvalue =2=可见

ddl1.selectedvalue =3=隐形

ddl1.selectedvalue =4=隐形

ddl1。 selectedvalue =5=隐形



谢谢你

解决方案

你必须动态绑定DDL列表项选择文本框的索引更改事件


hello and good day. i'm using vb.net

this is my drop down list:

<asp:DropDownList ID="ddl1" runat="server">
            <asp:ListItem Value=""></asp:ListItem>
            <asp:ListItem Value="1"></asp:ListItem>
            <asp:ListItem Value="2"></asp:ListItem>
            <asp:ListItem Value="3"></asp:ListItem>
            <asp:ListItem Value="4"></asp:ListItem>
            <asp:ListItem Value="5"></asp:ListItem>
            </asp:DropDownList>




I want to do something like this

if textbox1.text = "abc" Then

ddl1.selectedvalue = "1" = visible
ddl1.selectedvalue = "2" = visible
ddl1.selectedvalue = "3" = invisible
ddl1.selectedvalue = "4" = invisible
ddl1.selectedvalue = "5" = invisible

Thank you

解决方案

You have to bound DDL list items dynamically on selected index change event of text box


这篇关于如何显示特定条件的下拉列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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