DropdownList 赋初始值问题
2024-08-24 23:13:48
网上查了这样的代码 虽然是可以用。但是会点击多次会出现”“ dropdownList不能选多个值的问题“
private void initdroplistitemlirun(string c_Business)
{
if (this.Dplirun.Items.FindByText(c_Business) != null)
{
for (int i = ; i < this.Dplirun.Items.Count; i++)
{
this.Dplirun.Items[i].Selected = false;
if (this.Dplirun.Items[i].Text == c_Business)
{
Dpcompany.SelectedIndex = -;
this.Dplirun.Items[i].Selected = true;
break;
}
}
}
}
private void initdroplistitem(string c_Business)
{
if (this.Dpchengben.Items.FindByText(c_Business) != null)
{
for (int i = ; i < this.Dpchengben.Items.Count; i++)
{
this.Dpchengben.Items[i].Selected = false;
if (this.Dpchengben.Items[i].Text == c_Business)
{
Dpcompany.SelectedIndex = -;
this.Dpchengben.Items[i].Selected = true;
break;
}
}
}
}
最后发现 其实 用一句话就可以 那就是
this.Dpchengben.SelectedIndex = this.Dpchengben.Items.IndexOf(this.Dpchengben.Items.FindByText(YTmodel.goaltype.Trim()));
最新文章
- SVG:linearGradient渐变在直线上失效的问题解决方案
- js_apply与call
- C语言:链表实现的一个实例
- 看懂理解 keyboard中 , navigation的设置: 切换工作区和移动窗口到不同的工作区.
- Centos6版本升级
- ExchangeServeice获取在线outlook邮箱中的未读邮件
- Java应用调优指南之-工具篇
- HDU 5750 Dertouzos 简单数学
- pywinauto简单介绍
- asp.net word内容读取到页面
- ThinkPHP - 每个操作都检测用户是否登录
- 建立、配置和使用Activity——启动其他Activity并返回结果
- Centos7 修改硬件时间和系统时间
- 随心测试_软测基础_004<;测试人员工作职责>;
- 【easy】572. Subtree of Another Tree
- Linux服务器之间进行文件目录映射/挂载(总结)
- truffle init 从零开始创建简单DApp项目
- jquery计算时间差(天、时、分、秒)并使用定时器实时获取
- python---ORM之SQLAlchemy(3)外键与relationship的关系
- AlertDialog 无法去掉自带的白边