zoukankan      html  css  js  c++  java
  • The Controls collection cannot be modified because the control contains code blocks

    原来我在网页中的client javascript ,使用了 <%=%>,如下


    function
     setField() {   
    1.   var strUrl = "InvoiceDisplayFieldSetting.aspx?oid=<%=OID%>";   
    2.   window.showModalDialog(strUrl,"setField",   
    3.   "dialogWidth:400px;dialogHeight:630px;  
    4.   center:1;scroll:0;help:0;status:0;resizable=0");   
    5.   }  


    在 html 中的不会有问题, 但使用了<head runat=”server”> 后, client side javacript 就不能使用
    解法是override OnInit()
    如下

     
    1. override protected void OnInit(EventArgs e)   
    2.   {   
    3.   
    4.   base.OnInit(e);   
    5.   Page.DataBind();   
    6.   }  

    然后在 client side javacript ,改用 <%# OID%>
    大功告成

  • 相关阅读:
    TCP协议
    各相机品牌型号分类
    思科华为命令对比
    网工笔记(一)
    数学笔记
    word快捷键汇总
    请个假
    word笔记
    ScrollView不能到顶部的解决方法
    Gridview 显示成正方形
  • 原文地址:https://www.cnblogs.com/silva/p/1203922.html
Copyright © 2011-2022 走看看