Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Csharp.net
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 5-Sep-12 5:46am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Franco Cipriano at 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,
Wes Aday at 13-Sep-12 8:16am
   
And? That is exactly what this article shows you. What do you think a .cs file is?
Franco Cipriano at 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
aspnet_regiis at 1-Oct-12 11:56am
   
You cannot CALL javascript from server side.. However, you can initialize javascript from server-side using the above procedure..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "RedirectPage();", true);
  Permalink  
Comments
aspnet_regiis -i at 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)

  Print Answers RSS
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 319
2 CPallini 275
3 DamithSL 214
4 Maciej Los 185
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100