0
我在具有单个中继器的页面内控制用户。问题是当这个控件被放置在中继器复选框中时不会触发CheckedChanged事件。如果这将是一个动态添加的控件,我会检查CheckedCanged事件是否在Init()中分配了句柄,但这里的事件是在ascx中指定的,所以我想asp.net负责在正确的位置完成所有的任务。我迷失在这里:/中继器内用户控制内的复选框不会触发
顺便说一句。将单个复选框放在中继器内不会触发。但我至少可以使用OnItemCommand有
用户控制
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuoteContainer.ascx.cs" Inherits="EhdSite.Controls.QuoteContainer" %>
<asp:TableRow runat="server" ID="trQuoteRow">
<asp:CheckBox runat="server" ID="cbxConfirm" AutoPostBack="true" OnCheckedChanged="CbxConfirmCheckedChanged" />
</asp:TableRow>
页
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<asp:UpdatePanel runat="server" ID="upQuotes" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:Repeater runat="server" ID="rptQuotes">
<ItemTemplate>
<ehd:QuoteContainer
runat="server"
ID="qcQuote"
RowCssClass="rowStyle"
HighlightedRowCssClass="selectedRowStyle"
Quote="<%# Container.DataItem %>"
OnQuoteSelectedChanged="QuoteSelectedChanged" />
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
在此情况下,你绑定的中继?如果你在OnPreRender中使用它,它肯定无法工作!我需要看到usercontrol和页面的代码隐藏,或者至少有关中继器和checkbox的部分... – Vinz 2009-12-09 10:42:24
In page Page_Load – 2009-12-09 10:53:22
我将它移动到Page_Init并开始工作。你能解释它作为这个问题的答案,所以我可以给你信用? – 2009-12-09 10:56:07