Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DropDownList1.Items.Add("请选择方式")
DropDownList1.Items.Add("身份证")
DropDownList1.Items.Add("军人证") End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged If DropDownList1.SelectedItem.Text = "身份证" Then
Response.Redirect("email.aspx") End If End Sub为什么没反应呢
没进去的话看看DropDownList1前台aspx,是否设置AutoPostBack="true"
写上了, 还这样,不跳转
写上了
写上了
if (!Page.IsPostBack)
{
DropDownList1.Items.Add("请选择方式")
DropDownList1.Items.Add("身份证")
DropDownList1.Items.Add("军人证")
}
写错了...
if (!IsPostBack)
{
DropDownList1.Items.Add("请选择方式")
DropDownList1.Items.Add("身份证")
DropDownList1.Items.Add("军人证")
}……
{
//第一次加载页面或刷新页面时,不是点击提交按钮等回调时执行下面代码
DropDownList1.Items.Add("请选择方式")
DropDownList1.Items.Add("身份证")
DropDownList1.Items.Add("军人证")
}……
//然后
DropDownList1.AutoPostBack = True//最后在你的按钮事件,就是那个中转事件中,改成这样
Response.Redirect("email.aspx",true)
//注意第二个参数,具体它的作用请看工具的提示说明
//你们VB有点好玩,语句后面不用加分号结束