原问题:http://topic.csdn.net/u/20120222/21/63fda261-02c4-44f2-9b53-79367cddbfc6.html
Insus.NET已经在3楼回复了,帖主于6楼回复说,执行不了。
为DropDownList加一个属性AutoPostBack,并设为true。
另外还重构了一下写法:
View Code
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex == -1) return;
HyperlinkBind(DropDownList1.SelectedItem.Text);
}
private void HyperlinkBind(string name)
{
HyperLink1.Text = name;
HyperLink1.NavigateUrl = "http://www." + name + ".com";
}
{
if (DropDownList1.SelectedIndex == -1) return;
HyperlinkBind(DropDownList1.SelectedItem.Text);
}
private void HyperlinkBind(string name)
{
HyperLink1.Text = name;
HyperLink1.NavigateUrl = "http://www." + name + ".com";
}
演示: