How can I use runat=“server” on a script tag in asp.Net

后端 未结 5 1071
生来不讨喜
生来不讨喜 2021-02-19 04:00

I don\'t necessarily need to run it at server, however, I would like to use the ~/js/somefile.js syntax.

Previously, I had just set everything with Absolute

5条回答
  •  囚心锁ツ
    2021-02-19 04:13

    You can get fully what you want by wrapping script tag with asp:ContentPlaceHolder and the you can access it from code behind, for example set will it be executed or not by setting visible property to true or false. Here is the example:

        
        
    
    

    and from code behind:

    PrintPreviewBlock.Visible = true;
    

提交回复
热议问题