当前位置:编程学习 > C#/ASP.NET >>

DropDownList用了.Attributes.Add("onchange后不能响应SelectedIndexChanged)

DropDownList用了.Attributes.Add("onchange后不能响应SelectedIndexChanged)
代码如下
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        DropDownList1.Attributes.Add("onchange", "return fun1();")
End Sub

  Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        MsgBox("DropDownList1_SelectedIndexChanged")
    End Sub

function fun1()
  {
    if(confirm("1"))
    {
        
        return true;
    }
    else
    {
       
        return false;
    }
  }

执行了fun1 return true之后DropDownList1_SelectedIndexChanged没有提交到服务器,但是刷新页面后就被提交了..如何解决这个问题? --------------------编程问答-------------------- AutoPostBack=true --------------------编程问答-------------------- autopostback是true。。。 --------------------编程问答-------------------- DropDownList1.Attributes.Add( "onchange ",   "return   fun1(); ")和DropDownList1_SelectedIndexChanged都是触发onchange事件的,不可以同时用
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,