原问题:http://topic.csdn.net/u/20120222/21/63fda261-02c4-44f2-9b53-79367cddbfc6.html
Insus.NET已经在3楼回复了,帖主于6楼回复说,执行不了。
为DropDownList加一个属性AutoPostBack,并设为true。
另外还重构了一下写法:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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 ";
}
演示: