Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 ASP.NET Javascript , +
In asp.net,how to pass-value and call the function between C# and javascript?Thank you.
Posted 29-Aug-12 6:45am
pucx1.2K
Edited 29-Aug-12 6:46am
v2
Comments
Sandeep Mewara at 29-Aug-12 12:02pm
   
You mean C# from JavaScript OR JavaScript from C# ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Calling your javascript function from C# code is not difficult. And To pass value from C# to Javascript function is like passing parameter in the javascript function. if you have more parameters to pass and it is not possible to pass it though the function argument then you can use HiddenField to store your value. You can read HiddenField from the Javascript.
 
See This[^] discussion for passing parameter in javascript function from codebehind.
 
Hope this is what you want,
 
Thanks
-Amit Gajjar
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Using Hiddenfield you can pass value between C# and javascript
  Permalink  
Comments
pucx at 30-Aug-12 7:24am
   
Hiddenfield ?how to use Hiddenfield ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use page.registerclientscriptblock from c# code
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 428
1 Maciej Los 249
2 BillWoodruff 199
3 /\jmot 180
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 30 Aug 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