相关疑难解决方法(0)

ASP.NET DropDownList AutoPostback不工作 - 我缺少什么?

当我更改所选项目时,我试图通过UpdatePanel将DropDownList获取到AutoPostBack.我有点激动,为什么这不起作用.

有没有人有任何快速的想法?

ASPX页面:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" >      
  <ContentTemplate>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"  onselectedindexchanged="DropDownList1_SelectedIndexChanged">
      <asp:ListItem>item 1</asp:ListItem>
      <asp:ListItem>item 2</asp:ListItem>
    </asp:DropDownList>
  </ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)

代码隐藏(我在字符串赋值上设置断点来捕获回发):

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
  string s = "";
} 
Run Code Online (Sandbox Code Playgroud)

编辑:

好的,我现在就开始工作了.很奇怪.所需要的只是重新启动Visual Studio.作为一名开发人员,这种事情让我感到害怕;)我想我以前见过类似的东西,VS在运行的程序集中"不同步".

仅供参考我正在运行VS 2008 Web Developer Express.

感谢那些回答的人.

c# asp.net updatepanel autopostback

3
推荐指数
1
解决办法
4万
查看次数

标签 统计

asp.net ×1

autopostback ×1

c# ×1

updatepanel ×1