0

我有一个包含母版页的网页。它有两个下拉菜单。在 dropdown1 的 Selected index chagne 上,我称 dropdown1_selectedindex 已更改。但是,当我在第一个下拉菜单中更改选择时,什么也没有发生。我已将脚本管理器放在母版页中。控制页面中的更新面板。更新面板包含两个下拉菜单。请帮帮我。我是一个初学者,我认为这将是非常简单的。我在这里想念什么?

这是.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>
4

1 回答 1

2

感谢你们试图提供帮助。

我发现了触发器中的错误。在触发器中,eventname 应该是事件名称 SelectedIndexChanged 而不是 ddApplicationList_SelectedIndexChanged。

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

抱歉,我丢失了给我这个答案的另一个链接。

于 2013-03-14T15:14:05.347 回答