【发布时间】:2009-06-19 03:33:37
【问题描述】:
我有一个带有以下 scriptmanager 标签的母版页:
<asp:ScriptManager ID="scriptManger" EnablePartialRendering="true" runat="server" >
<Scripts>
<asp:ScriptReference Path="~/common/js/jquery-1.3.2.js" />
<asp:ScriptReference Path="~/common/js/validation.js" />
</Scripts>
</asp:ScriptManager>
我的 aspx 页面是:
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/common/MasterPages/Login.master" CodeBehind="SecurityQuestionsEnroll.aspx.cs" Inherits="Login.SecurityQuestionsEnroll" %>
<%@ Register src="~/controls/Views/Login/SecurityQuestions.ascx" tagname="SecurityQuestions" tagprefix="uc1" %>
这是用户控件:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="always" >
<ContentTemplate>
<asp:DataList ID="dlSecurityQuestions" runat="server" AutoPostBack="true" OnSelectedIndexChanged ="dlSecurityQuestions_SelectedIndexChanged">
<ItemTemplate>
<div>
<asp:Label ID="lbl_question" AssociatedControlID="lst_question" runat="server"><%# DataBinder.Eval(Container.DataItem, "QuestionName")%></asp:Label>
<asp:DropDownList ID="lst_question" runat="server" AutoPostBack="true" >
<asp:ListItem Value="0">Select a Question...</asp:ListItem>
<asp:ListItem Value="1">Select a Question1..</asp:ListItem>
</asp:DropDownList>
</div>
<div>
<asp:Label ID="lbl_answer1" AssociatedControlID="txt_answer" runat="server">Answer *</asp:Label>
<asp:TextBox ID="txt_answer" runat="server" />
<div id="validate"></div>
</div>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>
我已经尝试了谷歌推荐的大部分选项,但我无法进行部分回发。每次更改 selectedindex 时,它都会进行整页回发。如您所见,下拉菜单位于 itemtemplate 中并被重复。 你认为我做错了什么,它没有触发更新面板的回发。
【问题讨论】:
标签: asp.net-ajax user-controls updatepanel master-pages