| 发表于:2008-01-22 14:25:07 楼主 |
问题:某网站,左侧有多个html的image控件,当单击其中一个特定的image控件时,出现错误,而单击其他image控件的时候都正常。 错误如下: 类型“button”的控件“button1”必须放在具有 runat=server 的窗体标记内。 说明: 执行当前 web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: system.web.httpexception: 类型“button”的控件“button1”必须放在具有 runat=server 的窗体标记内。 源错误: 执行当前 web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪: [httpexception (0x80004005): 类型“button”的控件“button1”必须放在具有 runat=server 的窗体标记内。] system.web.ui.page.verifyrenderinginserverform(control control) +152 system.web.ui.webcontrols.button.addattributestorender(htmltextwriter writer) +38 system.web.ui.webcontrols.webcontrol.renderbegintag(htmltextwriter writer) +17 system.web.ui.webcontrols.webcontrol.render(htmltextwriter writer) +17 system.web.ui.control.rendercontrol(htmltextwriter writer) +243 system.web.ui.control.renderchildren(htmltextwriter writer) +72 system.web.ui.control.render(htmltextwriter writer) +7 system.web.ui.control.rendercontrol(htmltextwriter writer) +243 system.web.ui.page.processrequestmain() +1926 我的相关html代码: <script type="text/javascript"> <!-- function mm_swapimgrestore() { //v3.0 var i,x,a=document.mm_sr; for(i=0;a&&i <a.length&&(x=a[i])&&x.osrc;i++) x.src=x.osrc; } function mm_swapimage() { //v3.0 var i,j=0,x,a=mm_swapimage.arguments; document.mm_sr=new array; for(i=0;i <(a.length-2);i+=3) if ((x=mm_findobj(a[i]))!=null){document.mm_sr[j++]=x; if(!x.osrc) x.osrc=x.src; x.src=a[i+2];} } //--> </script> 其中就是单击“车辆运营部”才会出现错误。 <table cellspacing="0" cellpadding="0" width="97" border="0"> <tr> <td width="97" height="15"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image39','','images/办公室2.gif',1)" onmouseout="mm_swapimgrestore()" href="办公室.aspx"> <img id="image39" height="33" src="images/办公室1.jpg" width="97" border="0" name="image39"> </a> <a onmouseover="mm_swapimage('image5','','images/办公室2.jpg',1)" onmouseout="mm_swapimgrestore()" href="办公室.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image40','','images/设施管理部2.gif',1)" onmouseout="mm_swapimgrestore()" href="设施管理部.aspx"> <img id="image40" height="33" src="images/设施管理部1.jpg" width="97" border="0" name="image40"> </a> <a onmouseover="mm_swapimage('image6','','images/设施管理部2.jpg',1)" onmouseout="mm_swapimgrestore()" href="设施管理部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image41','','images/项目经理部2.gif',1)" onmouseout="mm_swapimgrestore()" href="项目经理部.aspx"> <img id="image41" height="33" src="images/项目经理部1.jpg" width="97" border="0" name="image41"> </a> <a onmouseover="mm_swapimage('image7','','images/项目经理部2.jpg',1)" onmouseout="mm_swapimgrestore()" href="项目经理部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a href="经营概算部.aspx" onmouseout="mm_swapimgrestore()" onmouseover="mm_swapimage('image42','','images/经营概算部2.gif',1)"> <img src="images/经营概算部1.jpg" name="image42" width="97" height="33" border="0" id="image42"> </a> <a onmouseover="mm_swapimage('image42','','images/经营概算部2.gif',1)" onmouseout="mm_swapimgrestore()" href="经营概算部.aspx"> </a> <a onmouseover="mm_swapimage('image8','','images/经营概算部.jpg',1)" onmouseout="mm_swapimgrestore()" href="经营概算部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image43','','images/材料部2.gif',1)" onmouseout="mm_swapimgrestore()" href="材料部.aspx"> <img id="image43" height="33" src="images/材料部1.jpg" width="97" border="0" name="image43"> </a> <a onmouseover="mm_swapimage('image9','','images/材料部2.gif',1)" onmouseout="mm_swapimgrestore()" href="材料部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image44','','images/车辆运营部2.gif',1)" onmouseout="mm_swapimgrestore()" href="车辆运营部.aspx"> <img id="image44" height="33" src="images/车辆运营部1.jpg" width="97" border="0" name="image44"> </a> <a onmouseover="mm_swapimage('image10','','images/车辆运营部2.gif',1)" onmouseout="mm_swapimgrestore()" href="车辆运营部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image45','','images/人事监察部2.gif',1)" onmouseout="mm_swapimgrestore()" href="人事监察部.aspx"> <img id="image45" height="33" src="images/人事监察部1.jpg" width="97" border="0" name="image45"> </a> <a onmouseover="mm_swapimage('image11','','images/人事监察部2.jpg',1)" onmouseout="mm_swapimgrestore()" href="人事监察部.aspx"> </a> </td> </tr> <tr> <td width="97" height="21"> </td> </tr> <tr> <td> <a onmouseover="mm_swapimage('image46','','images/技术安全部2.gif',1)" onmouseout="mm_swapimgrestore()" href="技术安全部.aspx"> <img id="image46" height="33" src="images/技术安全部1.jpg" width="97" border="0" name="image46"> </a> <a onmouseover="mm_swapimage('image12','','images/技术安全部2.jpg',1)" onmouseout="mm_swapimgrestore()" href="技术安全部.aspx"> </a> </td> </tr> |
|
|
|
|