C# 中继器内的文本框未使UpdateProgress触发
我在.aspx中有以下代码C# 中继器内的文本框未使UpdateProgress触发,c#,asp.net,updateprogress,C#,Asp.net,Updateprogress,我在.aspx中有以下代码 <asp:UpdatePanel ID="upnGrid" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Repeater ID="rpt1" runat="server" OnItemDataBound="rpt1_ItemDataBound">
<asp:UpdatePanel ID="upnGrid" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="rpt1" runat="server" OnItemDataBound="rpt1_ItemDataBound">
<ItemTemplate>
<table width="100%">
<tr>
<td align="right" width="25%">
<asp:Label ID="lbl1" Font-Bold="true" Font-Size="16px" Text=' <%# DataBinder.Eval(Container.DataItem,"Name") %>'
runat="server" />
</td>
<td>
<asp:HiddenField ID="hdn1" Value='<%# DataBinder.Eval(Container.DataItem, "Length") %>'
runat="server" />
</td>
<td>
<asp:TextBox ID="txt1" Font-Size="16px" Text='<%# DataBinder.Eval(Container.DataItem, "Value") %>'
AutoPostBack="true" Width="100px" OnTextChanged="txt1_TextChanged" runat="server" onkeydown="javascript:return OntxtEnter(event);"/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<%--<Triggers>
<asp:AsyncPostBackTrigger ControlID="rpt1"/>
</Triggers>--%>
</asp:UpdatePanel>
我不明白,为什么它不起作用
请建议
编辑
我试着在UpdatePanel中只放置所需的文本框,它显示以下错误
'System.Web.UI.Control' does not contain a definition for 'DataItem' and no extension method 'DataItem' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?)
尝试修改UpdateProgress
控件,如下所示:
加载。。。
您不能以这种方式使用它。因为在中继器内部,文本框ID是不同的。你必须遵循不同的机制。谢谢你的回复,但它在其他页面上运行良好,我认为这不是必需的解决方案。这就是我在代码中注册AsyncPostBack的原因。这样应该行得通。
var control = e.Item.FindControl("txt1");
ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(control);
'System.Web.UI.Control' does not contain a definition for 'DataItem' and no extension method 'DataItem' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?)
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:Panel ID="Panel2" runat="server">
<asp:ImageButton ID="ibProgress" runat="server" ImageUrl="~/Images/progress.gif"
Visible="true" />Loading...
</asp:Panel>
</asp:Panel>
</ProgressTemplate>
</asp:UpdateProgress>