ASP.NET更新面板GETS INVISIBLE
我有一个注册详细信息的Web表单。我在同一页面的更新面板中有一个提交按钮。如果用户没有输入任何内容并点击提交按钮,它应该对表单的所有必填字段进行验证,并显示一条消息,显示缺少哪些字段。ASP.NET更新面板GETS INVISIBLE
一旦进入提交与出输入任何内容,它是做验证,但抛出execption按钮:
Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder_Content_UpdatePanel_Submit'. If it is being updated dynamically then it must be inside another UpdatePanel.
和我的提交按钮变得不可见更新面板。代码是:
<asp:UpdatePanel ID="UpdatePanel_Submit" runat="server" UpdateMode='conditional'>
<ContentTemplate>
<div style="font-size: 12pt; width: 938px; margin-top: 5px; border-top: ridge 2px gray;">
<div style="margin-top: 10px; width: 938px;">
<asp:Button ID="btn_submit" runat="server" ToolTip="Click here to submit your request."
Text='Submit Request' onclick="btn_submit_Click" />
<asp:LinkButton ID="btn_cancel" runat="server" ToolTip=''>Cancel</asp:LinkButton></span>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
如何防止我的更新面板不可见?
随着UpdateMode Conditional,您可能需要添加ChildAsTriggers=true或添加Asyncpostback trigger到该按钮
几个例子:
http://asp-net-example.blogspot.com/2009/11/ajax-updatepanel-how-to-use-updatemode.html
我加入ChildrenA后再次测试sTriggers =“真”。它没有工作 – pka
显示服务器代码 –
@YuriyRozhovetskiy:在精神的OP的标题,我认为你的评论应该是:SHOW SERVER CODE :) –