我在对dropdownlist进行数据绑定时将ispostback设为true 页面会产生javascript错误:
form对象找不到对应的属性或方法 form.submit();出错
导致dropdownlist的事件无响应,
不知道这事什么原因,自动生成的代码也会出错,我真不知道是哪里出来错了,我自己没写代码也出了错,全都是托过开的

解决方案 »

  1.   

    代码贴出来看看!! form.submit();你javascript用了这个???
      

  2.   

    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form1'];
    if (!theForm) {
        theForm = document.form1;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
    </script>
      

  3.   

    贴出CS代码
    <asp:DropDownList id="ddl" runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="ddl_SelectedIndexChanged"></asp:DropDownList>
    protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
            {}
      

  4.   

     <asp:DropDownList ID="ddlJobKinds" runat="server" Width="152px" AutoPostBack="True" DataSourceID="obsJobKind" DataTextField="Job_kind_name" DataValueField="Job_kind_id" OnSelectedIndexChanged="ddlJobKinds_SelectedIndexChanged">
                        </asp:DropDownList></td>
    设置AutoPostBack="True"它运行页面会报错