网上查了这样的代码 虽然是可以用。但是会点击多次会出现”“ 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()));

DropdownList 赋初始值问题的更多相关文章

  1. Bash 什么时候会给 HOME 赋初始值

    今天无意发现下面这个表现: $  env -i bash -c cd bash: line 0: cd: HOME not set $ env -i bash -c 'echo $HOME' 这表明了 ...

  2. static 和 final 关键字 对实例变量赋初始值的影响

    static 和 final 关键字 对实例变量赋初始值的影响 最近一直在看<深入理解Java虚拟机>,在看完了对象内存分配.Class文件格式之后,想深扒一下实例变量是如何被赋上初始值的 ...

  3. (二)用控制器controller给模型数据赋初始值

    之前博客,非常easy的就实现了模型数据和页面显示的自己主动绑定.如今我们使用控制器,给模型赋初始值. 假设使用jquery来实现变量赋初值,须要在页面载入完毕后运行$("#target&q ...

  4. C语言赋初始值

  5. Vue中用props给data赋初始值遇到的问题解决

    Vue中用props给data赋初始值遇到的问题解决 更新时间:2018年11月27日 10:09:14   作者:yuyongyu    我要评论   这篇文章主要介绍了Vue中用props给dat ...

  6. vector 赋初始值的问题

    这个,输出为1 这个,啥都输不出来. 据说是因为没有初始化. 其实我搜了一下 vector<vector<int> > A;//正确的定义方式 vector<vector ...

  7. [转]Vue中用props给data赋初始值遇到的问题解决

    原文地址:https://segmentfault.com/a/1190000017149162 2018-11-28更:文章发布后因为存在理解错误,经@Kim09AI同学提醒后做了调整,在此深表感谢 ...

  8. 静态Map类型变量赋初始值

    private static Map<String,String> sysTypeList = new HashMap<String, String>(); static { ...

  9. 关于Delphi中二维数组赋初始值

    dctb:array[1..2,1..38] of Single=((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ...

随机推荐

  1. 宋牧春: Linux设备树文件结构与解析深度分析(1) 【转】

    转自:https://mp.weixin.qq.com/s/OX-aXd5MYlE_YoZ3p32qWA 作者简介 宋牧春,linux内核爱好者,喜欢阅读各种开源代码(uboot.linux.ucos ...

  2. juery中循环遍历json数组

    var dataList=[]; var stock0={stockcode:"007758",stockname:"商业政7",state:"1&q ...

  3. 94.Binary Tree Inorder Traversal---二叉树中序非递归遍历

    题目链接 题目大意:中序遍历二叉树.先序见144,后序见145. 法一:DFS,没啥说的,就是模板DFS.代码如下(耗时1ms): public List<Integer> inorder ...

  4. 190.Reverse Bits---位运算

    题目链接:https://leetcode.com/problems/reverse-bits/description/ 题目大意:将数值的二进制反转. 法一(借鉴):由于是无符号32位整型,当二进制 ...

  5. [转载]ACE的陷阱

    转自: http://blog.csdn.net/fullsail/article/details/2915685 坦白说,使用这个标题无非是希望能够吸引你的眼球,这篇文章的目的仅仅是为了揭示一些AC ...

  6. windows下phpstrom中xdebug的使用

    https://laravel-china.org/articles/16425/windows-phpstorm-xdebug-breakpoint-debugging

  7. tomcat打开gzip、配置utf-8

    在部署描述文件中配置如下内容:(web.xml) 打开gzip compression="on"配置utf-8 URIEncoding="UTF-8" < ...

  8. HDU-2222

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. Makefile的使用方法

    转自:http://blog.chinaunix.net/uid-403164-id-2407545.html 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Wind ...

  10. 洛谷 P2639 [USACO09OCT]Bessie的体重问题Bessie's We… 题解

    题目传送门 这也是个01背包,只是装的很... #include<bits/stdc++.h> #define MAXN 45010 using namespace std; int f[ ...