开发者

Run a script inside a content page. ASP.NET

开发者 https://www.devze.com 2023-01-01 04:11 出处:网络
I have a masterpage and content page. And I\'m trying to run a java script that needs to be executed on the page lo开发者_开发技巧ading.

I have a masterpage and content page. And I'm trying to run a java script that needs to be executed on the page lo开发者_开发技巧ading. As I am using a master page do not have access to the field My doubt is how to run the script within the content page? And where the script has to be? the head of the master page or inside the content page?


You can run C#/VB code on page load at any page or custom user control, so you will have access to whatever on the page.

I think you want to put that code in masterpage to standardize the procedure, one of the solutions (I don't know if you can accomblish this):

you can build your own "CustomPage" class by inheriting from "Page" so, you can set the onLoadEvent to a preset action.

and inherit from it for all your pages.


You could put a ContentPlaceholder in the Head section of your master page. Thats if you want to put your script in the Head

0

精彩评论

暂无评论...
验证码 换一张
取 消