Click here to Skip to main content
14,040,432 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 5 Jul 2011
Licenced CPOL

Embedding Javascript in Asp.Net

, 5 Jul 2011
Rate this:
Please Sign up or sign in to vote.
This is going to do something much more interesting than merely render some HTML to the browser. This is going to inject Javascript and CSS into its containing page.
There is one main class in the ASP.NET Framework included for working with Javascript: the ClientScriptManager class. This class is exposed by the Page.ClientScript property. The ClientScriptManager class has several useful methods for working with Javascript including:

Adds a script to a page right after the opening server-side <form> tag

Adds a script to a page right before the closing server-side <form> tag

Adds a reference to an external Javascript file
GetWebResourceUrl() - Returns the URL to a server-side resource

for more info: Building a Custom ASP.NET Control that uses Javascript, Cascading Style Sheets, and Ajax[^]


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sunasara Imdadhusen
Technical Lead Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen


  1. 2nd Best Mobile Article of January 2015
  2. 3rd Best Web Dev Article of May 2014
  3. 2nd Best Asp.Net article of MAY 2011
  4. 1st Best Asp.Net article of SEP 2010

Read More Articles...

You may also be interested in...

Comments and Discussions

General[My vote of 1] Not Clear at all Pin
Alireza_136228-Mar-13 20:05
memberAlireza_136228-Mar-13 20:05 
GeneralRe: [My vote of 1] Not Clear at all Pin
Sunasara Imdadhusen22-Apr-14 3:57
professionalSunasara Imdadhusen22-Apr-14 3:57 
GeneralReason for my vote of 2 This is too common and obvious to qu... Pin
Misha19645-Jul-11 12:39
memberMisha19645-Jul-11 12:39 
Reason for my vote of 2
This is too common and obvious to qualify as a tip
GeneralRe: Reason for my vote of 2This is too common and obvious to qu... Pin
Sunasara Imdadhusen22-Apr-14 3:58
professionalSunasara Imdadhusen22-Apr-14 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190425.1 | Last Updated 5 Jul 2011
Article Copyright 2011 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid