By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

how to call c# variable form code behind into javascript function in html page

P: 1
hi,

i work in asp.net2.0/c#.not much expert in javascript.i have a variable declared in the c# code behind page.assume the variable contains some value.

i have a javascript function in the <script> </script> area of the html source view of the corresponding aspx(asp.net)page.

my requirement is how do i access the variable which i mentioned above in the c# code behind page?i need to use the variable in the javascript function.

please show some light on how to get the variable from the c# code section to the javascript function which is situated in the html section......

please assist

thankyou in advance
supin
Apr 25 '07 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
hi,

i work in asp.net2.0/c#.not much expert in javascript.i have a variable declared in the c# code behind page.assume the variable contains some value.

i have a javascript function in the <script> </script> area of the html source view of the corresponding aspx(asp.net)page.

my requirement is how do i access the variable which i mentioned above in the c# code behind page?i need to use the variable in the javascript function.

please show some light on how to get the variable from the c# code section to the javascript function which is situated in the html section......

please assist

thankyou in advance
supin

There is a function in .NET that lets you register a hidden field. You can then access the hidden field in your JavaScript.

Please review the information provided by MSDN on how to do this.

Cheers!

-Frinny
Apr 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.