Click here to Skip to main content
15,945,603 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I made a javascript that pops-up a message box. I do not have problem calling it on the aspx page but i can't find a way to call it from a .cs file (class file). Any help is greatly appreciated.

Thanks,

Franco
Posted

 
Share this answer
 
Comments
Franco Cipriano 13-Sep-12 8:01am    
Hi,

Thanks, but this article only states how to call javascript from code-behind (aspx.cs) file. I am looking for a way on how to call a javascript from .cs file.

Thanks,
[no name] 13-Sep-12 8:16am    
And? That is exactly what this article shows you. What do you think a .cs file is?
Franco Cipriano 14-Sep-12 10:07am    
I am calling it from the class file that I added in the project, not the class file from the .aspx .. In the .cs file I do not have an option to call the ClientScript.RegisterClientScriptBlock
bbirajdar 1-Oct-12 11:56am    
You cannot CALL javascript from server side.. However, you can initialize javascript from server-side using the above procedure..
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "RedirectPage();", true);
 
Share this answer
 
Comments
bbirajdar 28-Nov-12 8:13am    
This is used to 'register' a javascript on the page. It does not 'call' it.. You will have to 'call' it from the client side only...

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900