我有我铸造我的下拉列表对象使用ChaseSelection类,C#有什么不对我的循环
现在我试图把该值从数据库中作为默认值在下拉列表,但似乎没有工作,任何人都可以帮忙吗?我甚至不认为我的循环运行。这里是我chaseselection类,并且也把下面的循环:由于
public class ChaseSelectionItems
{
public string code { get; set; }
public string text { get; set; }
public ChaseSelectionItems(string code, string text)
{
this.code = code;
this.text = text;
}
public override string ToString()
{
return this.text;
}
}
foreach (ChaseSelectionItems items in drpdwnChaseSecSelection.Items)
{
if (items.code == _Row.xcs_View)
{
drpdwnChaseSecSelection.SelectedValue = items.text;
}
}
放一个断点,看看调试中发生了什么 – Habib
define“似乎并不工作”。你有编译错误吗?运行时出现异常? (哪一个?)它没有抛出任何异常,但它不像你期待的那样行事? –
你使用哪个UI框架? WPF,WinForms等? –