我遇到了更新面板和中继器的问题。我有一个在更新面板中的中继器,我有一个在另一个更新面板中的 div。所以在中继器中我也有 GroupRadioButton。当显示单选按钮checkedchanged div时。通常我们无法到达外面的中继器项目。所以我在 itemdatabound 中对其进行编码。第一次点击正常工作。但是第二次点击页面是回发。我该如何解决?
这是我的转发器和 itemdatabound 事件。
<asp:UpdatePanel ID="upUsers" runat="server">
<ContentTemplate>
<div class="content">
<asp:Repeater id="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<vs:GroupRadioButton ID="rbChoose" GroupName="grup1" runat="server" OnCheckedChanged="select_CheckedChanged" AutoPostBack="true" />
... another control etc ...
</asp:Repeater>
</div>
</ContentTemplate>
</asp:UpdatePanel>
there are some buttons and controls between both two updatepanels ...
<asp:UpdatePanel ID="upUserDetails" runat="server">
<ContentTemplate>
<div class="content">
<div id="divUserDetails" runat="server">
... details ...
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
ScriptManager sm = (ScriptManager)Master.FindControl("scr");
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
GroupRadioButton rbChoose = e.Item.FindControl("rbChoose") as GroupRadioButton;
sm.RegisterAsyncPostBackControl(rbChoose);
trigger.ControlID = rbChoose.ID;
upUserDetails.Triggers.Add(trigger);
upUserDetails.UpdateMode = UpdatePanelUpdateMode.Always;
}
}