Javascript functions inside ASP.NET User Control

后端 未结 3 1190
逝去的感伤
逝去的感伤 2020-12-09 11:03

I created ASP.NET user control with javascript function :

<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"TestControl.ascx.cs\" Inherits         


        
3条回答
  •  忘掉有多难
    2020-12-09 11:18

    I found a solution in another site which allows you to use external file

    if (!Page.ClientScript.IsClientScriptIncludeRegistered("key"))
    
    {
    
       string url = ResolveClientUrl("~/Scripts/file.js");
    
       Page.ClientScript.RegisterClientScriptInclude("key", url);
    
    }
    

提交回复
热议问题