当前位置: 代码迷 >> ASP.NET >> 内容页中使用上拉框,为什么onselectedindexchanged事件会报错Microsoft JScript 运行时异常: 找不到成员
  详细解决方案

内容页中使用上拉框,为什么onselectedindexchanged事件会报错Microsoft JScript 运行时异常: 找不到成员

热度:5222   发布时间:2013-02-25 00:00:00.0
内容页中使用下拉框,为什么onselectedindexchanged事件会报错Microsoft JScript 运行时错误: 找不到成员。

内容页中使用下拉框,为什么onselectedindexchanged事件会报Microsoft JScript 运行时错误: 找不到成员。
<asp:Content ID="Content2" ContentPlaceHolderID="m_content" Runat="Server">
  <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
  onselectedindexchanged="DropDownList1_SelectedIndexChanged">
  <asp:ListItem Value="safa1">fsafd</asp:ListItem>
  <asp:ListItem Value="saf2">fdsaf</asp:ListItem>
  </asp:DropDownList>
</asp:Content>


------解决方案--------------------------------------------------------
Quote=引用:]
应该是AutoPostBack设置为true的原因,不过不知如何解决
[/Quote]
和AutoPostBack属性没关系,应该是你代码上的错误,我把你代码复制运行没有任务错误。你可以新建一个简单的测试环境试试,是不会出现那个问题的


HTML code
母板页<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title>    <asp:ContentPlaceHolder ID="head" runat="server">    </asp:ContentPlaceHolder></head><body>    <form id="form1" runat="server">    <div>        <div style="font-size: 50px;">            Mater</div>        <asp:ContentPlaceHolder ID="m_content" runat="server">        </asp:ContentPlaceHolder>    </div>    </form></body></html>
  相关解决方案