1、页面上添加
实现代码如下:
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
2、在head之间
实现代码如下:
<script type="text/javascript">
function openwindow(url) {
if (url != "") {
window.open(url);
}
}
</script>
3、cs代码
实现代码如下:
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Attributes.Add("onchange", "javascript:openwindow(this.value)");
}
以上就是【C# DropDownList中点击打开新窗口的方法】的全部内容了,欢迎留言评论进行交流!