servercontrol

Add <Script … /> tag within <Head … /> tag in ServerControl (ASP.NET)?

梦想与她 提交于 2019-12-01 11:06:16
I'm gonna use JQuery files in my custom ServerControl , thus I have to add below line within Head tag. <script type="text/javascript" src="jquery-1.4.3.min.js"></script> How can I do it in ServerControl with C# You can register custom scripts using the ClientScriptManager.RegisterClientScriptInclude Method during the page load. Alternatively, you can just include the script in your .aspx page. If this is a public server control, the first method is probably more preferable. EDIT: alternatively you can register scripts in the <head> tag of the page as follows: HtmlGenericControl jqueryInclude =

Add <Script … /> tag within <Head … /> tag in ServerControl (ASP.NET)?

吃可爱长大的小学妹 提交于 2019-12-01 07:28:04
问题 I'm gonna use JQuery files in my custom ServerControl , thus I have to add below line within Head tag. <script type="text/javascript" src="jquery-1.4.3.min.js"></script> How can I do it in ServerControl with C# 回答1: You can register custom scripts using the ClientScriptManager.RegisterClientScriptInclude Method during the page load. Alternatively, you can just include the script in your .aspx page. If this is a public server control, the first method is probably more preferable. EDIT: