2013-03-07 69 views
0

我有一個擁有主頁的網頁。它有兩個下拉。在Dropdown1的選定索引chagne上,我調用dropdown1_selectedindex已更改。但是,當我在第一個下拉菜單中更改選擇時沒有任何反應。我已經將腳本管理器放置在母版頁中。控制頁面中的更新面板。更新面板包含兩個下拉列表。 Pelase幫助我。我是首發,我認爲這將是非常簡單的。我在這裏錯過了什麼?UpdatePanel將不會調用控件事件方法

這是在.aspx

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master"  CodeBehind="Emailer.aspx.cs" Inherits="ServiceAlertEmailerGUI.Emailer" %> 

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> 
    </asp:Content> 
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> 
    <%-- <h2> 
     Welcome to ASP.NET! 
    </h2>--%> 
    <%-- <p> 
      To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>. 
    </p>--%> 
    <%-- <p> 
     You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409" 
      title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>. 
    </p>--%> 

    <script type="text/javascript"> 
     function HandleIT() { 
      alert("called"); 
     } 
    </script> 


    <asp:Label ID="Label1" runat="server" Text="Status:"></asp:Label> 
    <asp:RadioButton ID="RadioButton1" Text="New Alert" GroupName="Status" runat="server" /> 
    <asp:Label ID="Label2" runat="server" Text="Select Application: "></asp:Label> 
    <asp:UpdatePanel runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"> 
    <ContentTemplate> 
    <asp:DropDownList ID="ddApplicationList" runat="server" 

      OnSelectedIndexChanged="ddApplicationList_SelectedIndexChanged"> 
    </asp:DropDownList> 
    <br /> 
    <asp:RadioButton ID="RadioButton2" GroupName="Status" Text="Update" runat="server" /> 
    <asp:Label ID="Label3" runat="server" Text="Select Service: "></asp:Label> 
    <asp:DropDownList ID="ddServcieList" runat="server" > 
    </asp:DropDownList> 
    </ContentTemplate> 
    <%-- 
    <Triggers> 
      <asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName="ddApplicationList_SelectedIndexChanged" /> 
     </Triggers> 
    --%> 
     </asp:UpdatePanel> 
    <br /> 
    <asp:RadioButton ID="RadioButton3" GroupName="Status" Text="Resolved" runat="server" /><br /> 
    <asp:RadioButton ID="RadioButton4" GroupName="Status" Text="Resolved (No Email)" runat="server" /> 
    <asp:Button ID="Button1" runat="server" Text="Build Template" Width="144px" /> 
    <br /> 
    <asp:RadioButton ID="RadioButton5" GroupName="Status" Text="Root Cause" runat="server" /><br /> 
    <br /> 

    </asp:Content> 

這裏是母版頁試圖幫助

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="ServiceAlertEmailerGUI.SiteMaster" %> 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
    <head runat="server"> 
     <title></title> 
     <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" /> 
     <asp:ContentPlaceHolder ID="HeadContent" runat="server"> 
     </asp:ContentPlaceHolder> 
    </head> 
    <body> 
    <form runat="server"> 
    <asp:ScriptManager ID="AjaxManager" EnablePageMethods ="true" EnablePartialRendering = "true" runat="server"> 
    </asp:ScriptManager> 
    <div class="page"> 
     <div class="header"> 
      <div class="title"> 
       <h1> 
        Service Alert Emailer 
       </h1> 
      </div> 
    <%--   <div class="loginDisplay"> 
       <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"> 
        <AnonymousTemplate> 
         [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ] 
        </AnonymousTemplate> 
        <LoggedInTemplate> 
         Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>! 
         [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ] 
        </LoggedInTemplate> 
       </asp:LoginView> 
      </div>--%> 
      <div class="clear hideSkiplink"> 
       <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> 
        <Items> 
         <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Emailer"/> 
         <%--<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>--%> 
        </Items> 
       </asp:Menu> 
      </div> 
     </div> 
     <div class="main"> 
      <asp:ContentPlaceHolder ID="MainContent" runat="server"/> 
     </div> 
     <div class="clear"> 
     </div> 
    </div> 
    <div class="footer"> 

    </div> 
    </form> 
    </body> 
    </html> 
+0

如果我添加了AsyncPsotBackTrigger這樣 我收到錯誤消息「無法找到名爲事件的相關控制‘ddApplicationList_SelectedIndexChanged’'在UpdatePanel中觸發器的「ddApplicationList」。 – Oogway 2013-03-07 21:02:51

回答

2

謝謝你們。

我想出了觸發器中的錯誤。在觸發器中,eventname應該是事件名稱SelectedIndexChanged,而不是ddApplicationList_SelectedIndexChanged。

<Triggers> 
      <asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName = "SelectedIndexChanged"/> 
</Triggers> 

對不起,我失去了另一個給我這個答案的鏈接。

相關問題