方法如下:
1.新建站点,在默认页面中放入三个控件 : a. Textbox b. Button c. ListBox
将ListBox 的Visible改为false
2.将Button1的Text改为一个下拉的三角(▼),双击button1,添加click事件.代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
if (this.ListBox1.Visible == false)
{
this.ListBox1.Visible = true;
}
else
{
this.ListBox1.Visible = false;
}
}
3.双击 ListBox1,添加electedIndexChanged事件..代码如下:
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.TextBox1.Text = this.ListBox1.SelectedItem.Text.ToString();
this.ListBox1.Visible = false;
}
这样一个combox就完成了..如果你不介意.可以做成控件自己使用.
图片上方是我的email , 以上为原创 , 本人不才 ,请多指教.