疯狂郁闷中。。。。。关于ListBox值读出,请进看LOOK一下!(在线等)
控件绑定的代码(绑定测试是成功的)
lstZtmc.DataSource=dstShow.Tables["ZhanMing"];
lstZtmc.DataTextField="MingCheng";
lstZtmc.DataValueField="DianBaoMa";
lstZtmc.DataBind();
控件读出的代码:
StringBuilder sb = new StringBuilder("");
for (int i=0;i<lstZtmc.Items.Count;i++)
{
if( lstZtmc.Items[i].Selected==false)
{
sb.Append("'");
sb.Append(lstZtmc.Items[i].Value);
sb.Append("',");
}
test2.Text=sb.ToString();
}
奇怪的事,我在界面中明明选中了此LstZtmc中的若干项,可Sb.ToString的值中总是为空!何解,请点拔一下,谢谢!