按钮取值时,ListBox的值怎么老是初始时的默认值,而不是当前值,好象我点按钮是有重新把本页登陆了一下:
private string GetBoxList()
{
//directory
int i,j = 0;
string strcondition;
string s = " where directory in (";
if (ListBox1.Items.Count != 0)
{
for (i = 0; i < (ListBox1.Items.Count); i++)
{
if (ListBox1.Items[i].Selected == true)
{
s = s + "''" + ListBox1.Items[i].ToString().TrimEnd() + "'',";
j ++;
}
}
s = s.Substring(0,s.Length - 1);
if (j == 0)
{
s = " where directory in (";
for (i = 0; i <= (ListBox1.Items.Count-1); i++)
{
s = s + "''" + ListBox1.Items[i].ToString().TrimEnd() + "'',";
}
s = s.Substring(0,s.Length - 1);
}
strcondition = s + ")";