Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Asheej T K
(201)
Alwyn
(165)
Avinash Mohan
(130)
Last 7 Days
Alwyn
(1087)
Asheej T K
(774)
Avinash Mohan
(593)
more...
Resources
»
Code Snippets
»
Javascript
»
Passing value from codebehind page to .js file
Posted Date: 13 Aug 2009
Resource Type:
Code Snippets
Category:
Javascript
Author:
Madhu
Member Level:
Bronze
Rating:
Points
: 5
When you run the program, A function in .js file executes and display value in popup window.
In Default.aspx page. inside body call the function and pass the value as shown
< head>
< script src="JScript.js" type="text/javascript">
< /head>
< body>
< form id="form1" runat="server">
< asp:Label ID="Label1" runat="server" Text="Label">
< script type="text/javascript">
dispcal(document.getElementById("<%=Label1.ClientID%>").innerHTML)
< /script>
< /form>
< /body>
< /html>
//in Default.aspx.cs
//codebehind page. Assign the value to some label
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "5";
}
//in JScript.js file
function dispcal(val) {alert(val);}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
Javascript
.
Codebehind to .js
.
Aspx to .js
.
.js
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Checkbox list validation
Previous Resource:
Check box list validation through javascript
Return to Discussion Resource Index
Post New Resource
Category:
Javascript
Post resources and
earn money
!
More Resources
Checkbox list validation
Hide Status bar
Validate the character and Numbers
Validate a date Field using javascript
How do you access the server side function using javascript in asp.net 3.5?
Copying Gridview Data using javascript
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use