0

我有一个表单,其中有两个组合框和一个网格,我已经在组合框的 selectedindex 更改事件上编写了过滤代码,为组合框设置了SuggestAppend 属性。当我输入一个国家名称,例如印度并按输入选择索引更改事件不会立即触发,当我单击某个地方时,它会触发并提供输出。请建议我该怎么做。在此先感谢

protected void cbCountry_SelectedIndexChanged(object sender, EventArgs e) { GetCondition(); 填充网格();}

 public string GetCondition()
        {
            string Condition = "";
            if (cbEmployee.SelectedIndex > 0)
            {
                Condition = Condition + " And reg_no=" + cbEmployee.SelectedValue;
            }

            if (cbCountry.SelectedIndex > 0)
            {
                Condition = Condition + " And country='" + cbCountry.SelectedItem.Text + "'";
            }
  return Condition;
        }
4

1 回答 1

0

签入声明事件的表单设计器 (designer.cs)

this.cbCountry.SelectedIndexChanged += new System.EventHandler(this.cbCountry_SelectedIndexChanged);

如果未声明,您可以在设计器或表单加载中添加它

于 2012-10-03T09:15:40.617 回答