Click here to Skip to main content
Click here to Skip to main content

Tagged as

Embedding Javascript in Asp.Net

, 5 Jul 2011 CPOL
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:
 

RegisterClientScriptBlock():
Adds a script to a page right after the opening server-side <form> tag
 
RegisterStartupScript():
Adds a script to a page right before the closing server-side <form> tag
 
RegisterClientScriptInclude():
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[^]

License

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

Share

About the Author

Sunasara Imdadhusen
Software Developer (Senior) 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
 
AWARDS:
  1. 1st Best Asp.Net article of SEP 2010
  2. 2nd Best Asp.Net article of MAY 2011
 
Read More Articles...
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
General[My vote of 1] Not Clear at all PinmemberAlireza_136228-Mar-13 21:05 
GeneralRe: [My vote of 1] Not Clear at all PinprofessionalSunasara Imdadhusen22-Apr-14 4:57 
GeneralReason for my vote of 2 This is too common and obvious to qu... PinmemberMisha19645-Jul-11 13:39 
GeneralRe: Reason for my vote of 2This is too common and obvious to qu... PinprofessionalSunasara Imdadhusen22-Apr-14 4:58 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150123.1 | Last Updated 5 Jul 2011
Article Copyright 2011 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid