Asp.net “更新”面板已停止运行
我不知道这里发生了什么事。但是我的页面上有一个更新面板,在州下拉菜单selecteditem事件中填充城市下拉菜单。 它曾经起作用,但由于某种原因,现在它不起作用了。它甚至不会弹出我在事件中作为第一行代码放置的消息框 这是标记Asp.net “更新”面板已停止运行,asp.net,drop-down-menu,updatepanel,Asp.net,Drop Down Menu,Updatepanel,我不知道这里发生了什么事。但是我的页面上有一个更新面板,在州下拉菜单selecteditem事件中填充城市下拉菜单。 它曾经起作用,但由于某种原因,现在它不起作用了。它甚至不会弹出我在事件中作为第一行代码放置的消息框 这是标记 <!-- State dropdown selector area --> <asp:DropDownList ID="ddlState" runat="server" AppendD
<!-- State dropdown selector area -->
<asp:DropDownList ID="ddlState" runat="server"
AppendDataBoundItems="True" CssClass="dropdowns"
BorderColor="Black"
BorderStyle="Solid" BorderWidth="2px" TabIndex="7"
DataSourceID="EntityDataSource1" DataTextField="Name"
DataValueField="Id" ToolTip="Select a state here" AutoPostBack="True">
<asp:ListItem Value="" Text="Select a state"/>
</asp:DropDownList>
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=enerteckEntities"
DefaultContainerName="enerteckEntities" EnableFlattening="False" EntitySetName="states"
Select="it.[Name], it.[Id]">
</asp:EntityDataSource>
<asp:RequiredFieldValidator ID="rfvState" runat="server"
ErrorMessage="Please select a state from the dropdown list"
Display="Dynamic" ControlToValidate="ddlState"
ForeColor="#FF3300">
</asp:RequiredFieldValidator>
<!-- End of State dropdown selector area -->
<br /><br />
<asp:UpdatePanel ID="updtPanelCity" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlCity" runat="server"
AppendDataBoundItems="True" CssClass="dropdowns"
BorderColor="Black"
BorderStyle="Solid" BorderWidth="2px" TabIndex="8"
ToolTip="Select a city here" AutoPostBack="True">
<asp:ListItem Value="" Text="Select a city"/>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvCity" runat="server"
ErrorMessage="Please select a city from the dropdown list"
Display="Dynamic" ControlToValidate="ddlCity"
ForeColor="#FF3300">
</asp:RequiredFieldValidator>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlState" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
我需要另一双眼睛来观察这个问题
编辑:
下面是scriptmanager中的内容
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<%--Framework scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="jquery.ui.combined" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site scripts--%>
</Scripts>
</asp:ScriptManager>
1您可以在UpdatePanel上添加
UpdateMode
属性。并设置为有条件
<asp:UpdatePanel ID="updtPanelCity"
UpdateMode="Conditional"
runat="server">
....
....
2并将ddl放在更新面板中
<ContentTemplate>
....
<asp:DropDownList ID="ddlState" runat="server"
AppendDataBoundItems="True" CssClass="dropdowns"
BorderColor="Black"
BorderStyle="Solid" BorderWidth="2px" TabIndex="7"
DataSourceID="EntityDataSource1" DataTextField="Name"
DataValueField="Id" ToolTip="Select a state here" AutoPostBack="True">
<asp:ListItem Value="" Text="Select a state"/>
</asp:DropDownList>
</ContentTemplate>
....
3并将
OnSelectedIndexChanged=“
添加到您的DLL状态中母版页中有脚本管理器,因此它位于同一更新面板中此页的页眉中?您应该能够从更新面板外部的控件调用更新面板刷新,不是吗?不,您必须添加ContentTemplate,并且更新面板的条件定义为您所做的
<ContentTemplate>
....
<asp:DropDownList ID="ddlState" runat="server"
AppendDataBoundItems="True" CssClass="dropdowns"
BorderColor="Black"
BorderStyle="Solid" BorderWidth="2px" TabIndex="7"
DataSourceID="EntityDataSource1" DataTextField="Name"
DataValueField="Id" ToolTip="Select a state here" AutoPostBack="True">
<asp:ListItem Value="" Text="Select a state"/>
</asp:DropDownList>
</ContentTemplate>