问题描述
我发现如果用户控件放在UpdatePanel中,则根本不会更新具有文字的用户控件。
< asp:UpdatePanel ID =" Login_UpdatePanel" runat =" server">
< ContentTemplate>
< asp:Literal ID =" warning_message_literal_in_UP" runat =" server">< / asp:Literal>
< uc:uc1 id =" some_user_control" runat =" server">< / uc>
< / ContentTemplate><触发器>
< asp:AsyncPostBackTrigger ControlID =" Login_button" ;事件名称= QUOT;按一下[ />
< /触发器>< / asp:UpdatePanel>
如果我只需使用
warning_message_literal_in_UP.text =" tatata"
文字已更新!,但如果我使用
some_user_control.my_text_property =" tatata"然后,它不起作用。这个原因我必须在三个不同的页面上使用相同的代码。否则我可以使用它作为用户控件。
任何想法?谢谢。
I found that a user control which has a literal is not updated at all if it is put within UpdatePanel.
<asp:UpdatePanel ID="Login_UpdatePanel" runat="server">
<ContentTemplate>
<asp:Literal ID="warning_message_literal_in_UP" runat ="server"></asp:Literal>
<uc:uc1 id="some_user_control" runat="server"></uc>
</ContentTemplate><Triggers>
<asp:AsyncPostBackTrigger ControlID="Login_button" EventName="Click" />
</Triggers></asp:UpdatePanel>
If I just use
warning_message_literal_in_UP.text = "tatata"
the literal is updated!, but if I use
some_user_control.my_text_property = "tatata"then, it does not work. This reason I have to use same code on three different pages. Otherwise I could use it once as a user control.
Any ideas? Thanks.
这篇关于updatepanel中的文字VS literal-in-a-user-contol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!