JavaScript运行时错误:Sys.InvalidOperationException [英] JavaScript runtime error:Sys.InvalidOperationException
本文介绍了JavaScript运行时错误:Sys.InvalidOperationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JavaScript运行时错误:Sys.InvalidOperationException:具有相同IDmpeAttachment的两个组件无法添加到应用程序中。
但我使用不同的类型ID仅适用于模态弹出式mpeAttachment和mpetimeout
任何人请解决此问题
< asp:HiddenField runat =serverID =HiddenAttachment/>
< asp:ModalPopupExtender ID =mpeAttachmentsPopupControlID =pnlAttachmentsrunat =server
CancelControlID =lnkExitTargetControlID =HiddenAttachmentBackgroundCssClass =modalBackground>
< / asp:ModalPopupExtender>
< asp:Panel runat =serverID =pnlAttachmentsCssClass =modalPopupStyle =width:456px;
height:266px;>
< table width =100%>
< tr>
< td class =blankrow>
< / td>
< td>
< / td>
< / tr>
< tr>
< td style =font-size:20px; font-style:normal>
文件附件
< / td>
< / tr>
< tr>
< td class =blankrow>
< / td>
< td>
< / td>
< / tr>
< tr>
< td>
< asp:Label runat =serverID =lblbrowseText =步骤1-点击浏览以从您的计算机中选择一个文件/>
< / td>
< / tr>
< tr>
< td>
<% - < asp:UpdatePanel ID =UpdatePanel1runat =server>
< ContentTemplate>
< asp:FileUpload ID =FileUploadControlStyle =width:445px; runat =server/>
< / ContentTemplate>
<触发器>
< asp:PostBackTrigger ControlID =btnUpload/>
< /触发器>
< / asp:UpdatePanel> - %>
< / td>
< / tr>
< tr>
< td>
< asp:Label ID =lblAttachmentDescriptionrunat =serverText =步骤2-给我这个文件的简要说明/>
< asp:Label ID =lblErrorMessagerunat =serverVisible =falseStyle =float:left;
color:red;>< / asp:Label>
< / td>
< / tr>
< tr>
< td>
< asp:TextBox runat =serverWidth =442pxID =txtAttachmentDescription/>
<% - < asp:RequiredFieldValidator runat =serverid =valid1ControlToValidate =txtAttchmentDescriptionErrorMessage =enter/> - %>
< / td>
< / tr>
< tr>
< td>
< asp:Label ID =lblselectfilerunat =serverText =步骤3-点击上传以上传所选文件/>
< / td>
< / tr>
< tr>
< td align =right>
< asp:Button ID =btnUploadStyle =display:blockWidth =84pxrunat =serverText =Upload/>
< / td>
< / tr>
< tr>
< / tr>
< tr>
< td align =center>
< asp:LinkButton ID =lnkExitrunat =serverText =CancelFont-Underline =trueStyle =color:Blue; />
< / td>
< / tr>
< / table>
< / asp:Panel>
我的另一个模态弹出窗口
< asp:ModalPopupExtender ID =mpetimeoutPopupControlID =pnltimeoutBehaviorID =mpetimeout
runat =serverTargetControlID =Hidden1BackgroundCssClass =modalBackground>
< / asp:ModalPopupExtender>
< asp:HiddenField runat =serverID =Hidden1/>
< asp:Panel ID =pnltimeoutrunat =serverCssClass =modalPopupStyle =width:390px;>
< table width =100%>
< tbody>
< tr>
< td align =center>
安全提示
< / td>
< / tr>
< tr align =center>
< td>
您的会话已暂停一段时间了。< br />
出于安全目的,会话将以< span id =myCounterstyle =color:Red>终止。
< / span>秒。
< br />
如果要继续,则应保存数据,否则请选择注销。
< / td>
< / tr>
< / tbody>
< / table>
< table width =100%>
< tr align =center>
< td>
< asp:Button runat =serverText =LogoutID =btnSessionNo/>
< asp:Button runat =serverText =SaveDataOnClientClick =return myStopFunction();
ID =btnSessionYes/>
< / td>
< / tr>
< / table>
< / asp:Panel>
感谢提前
解决方案
有一个分号问题。这两个链接可以帮到你。
http://penyaskitodice.wordpress.com/2008/06/12/multiple-modal-popups-with-the-aspnet-ajax-toolkit/ [< a href =http://penyaskitodice.wordpress.com/2008/06/12/multiple-modal-popups-with-the-aspnet-ajax-toolkit/\"target =_ blanktitle =New Window> ^ ]
http:// forums .asp.net / p / 1157697 / 2719378.aspx [ ^ ]
JavaScript runtime error: Sys.InvalidOperationException: Two components with the same id 'mpeAttachment' can't be added to the application.
But i use different types of ID only for modal Popup mpeAttachment and mpetimeout
Anybody Please Solve this issue
<asp:HiddenField runat="server" ID="HiddenAttachment" /> <asp:ModalPopupExtender ID="mpeAttachments" PopupControlID="pnlAttachments" runat="server" CancelControlID="lnkExit" TargetControlID="HiddenAttachment" BackgroundCssClass="modalBackground"> </asp:ModalPopupExtender> <asp:Panel runat="server" ID="pnlAttachments" CssClass="modalPopup" Style="width: 456px; height: 266px;"> <table width="100%"> <tr> <td class="blankrow"> </td> <td> </td> </tr> <tr> <td style="font-size: 20px; font-style: normal"> File Attachment </td> </tr> <tr> <td class="blankrow"> </td> <td> </td> </tr> <tr> <td> <asp:Label runat="server" ID="lblbrowse" Text="Step 1- click browse to select a file from your computer" /> </td> </tr> <tr> <td> <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:FileUpload ID="FileUploadControl" Style="width: 445px;" runat="server" /> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnUpload" /> </Triggers> </asp:UpdatePanel>--%> </td> </tr> <tr> <td> <asp:Label ID="lblAttachmentDescription" runat="server" Text="Step 2- give me a brief description of this file" /> <asp:Label ID="lblErrorMessage" runat="server" Visible="false" Style="float: left; color: red;"></asp:Label> </td> </tr> <tr> <td> <asp:TextBox runat="server" Width="442px" ID="txtAttachmentDescription" /> <%--<asp:RequiredFieldValidator runat="server" id="valid1" ControlToValidate="txtAttchmentDescription" ErrorMessage="enter" />--%> </td> </tr> <tr> <td> <asp:Label ID="lblselectfile" runat="server" Text="Step 3- click upload to upload a selected file" /> </td> </tr> <tr> <td align="right"> <asp:Button ID="btnUpload" Style="display: block" Width="84px" runat="server" Text="Upload" /> </td> </tr> <tr> </tr> <tr> <td align="center"> <asp:LinkButton ID="lnkExit" runat="server" Text="Cancel" Font-Underline="true" Style="color: Blue;" /> </td> </tr> </table> </asp:Panel>
And my another modal popup
<asp:ModalPopupExtender ID="mpetimeout" PopupControlID="pnltimeout" BehaviorID="mpetimeout" runat="server" TargetControlID="Hidden1" BackgroundCssClass="modalBackground"> </asp:ModalPopupExtender> <asp:HiddenField runat="server" ID="Hidden1" /> <asp:Panel ID="pnltimeout" runat="server" CssClass="modalPopup" Style="width: 390px;"> <table width="100%"> <tbody> <tr> <td align="center"> Security Alert </td> </tr> <tr align="center"> <td> Your session have been idle for some time now.<br /> For security purpose the session will be terminated in <span id="myCounter" style="color: Red"> </span>seconds. <br /> If you want to continue, you should save the data otherwise select logout. </td> </tr> </tbody> </table> <table width="100%"> <tr align="center"> <td> <asp:Button runat="server" Text="Logout" ID="btnSessionNo" /> <asp:Button runat="server" Text="SaveData" OnClientClick="return myStopFunction();" ID="btnSessionYes" /> </td> </tr> </table> </asp:Panel>
thanks in Advance
解决方案
There is an issue of semicolon. This two links may help you.
http://penyaskitodice.wordpress.com/2008/06/12/multiple-modal-popups-with-the-aspnet-ajax-toolkit/[^]
http://forums.asp.net/p/1157697/2719378.aspx[^]
这篇关于JavaScript运行时错误:Sys.InvalidOperationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文