Is there a way to use “<%= someObject.ClientID %>” in an external javascript file?

前端 未结 8 1278
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 15:28

Is there a way to use \"<%= someObject.ClientID %>\" in an external javascript file?

If I use the code

<%= someObject.ClientID %>
         


        
8条回答
  •  暖寄归人
    2020-12-04 16:33

    You could create an empty callback function in the external file:

    var MyCallback = function () { };
    

    And then in the asp/cx do something like:

    MyCallback = function () {return "<%= someObject.ClientID %>";}
    

    And then, back in your external file:

    var myClientID = MyCallback();
    

提交回复
热议问题