How to Inject a JavaScript method from CodeBehind Class in ASP.Net?
.Net 2.0 introduced a new class called ClientScriptManager to do this task easily. ClientScript property of the Page object will give us an instance of ClientScriptManager object. This class uniquely identifies scripts by a key String and a Type. Scripts with the same key and type are considered duplicates and hence similar scripts are avoided. The below code will explain us 2 of the useful methods of ClientScriptManager object that helps in injecting JavaScript methods.
Related Questions
- A class inherits from 2 interfaces and both the interfaces have the same method name as shown below. How should the class implement the drive method for both Car and Bus interface?
- How do i limit the width of the TSViewer when using the JavaScript or PHP method?
- How does an object call an inner class method?