Exforsys

Online Training

Call javascript function in C#

This is a discussion on Call javascript function in C# within the Microsoft .NET forums, part of the Programming Talk category; How can i "Call JavaScript function in C# and C# function or objects id JavaScript"...


Go Back   Exforsys > Programming Talk > Microsoft .NET

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  4 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 11-07-2006, 01:56 PM
Junior Member
 
Join Date: Apr 2006
Posts: 25
Limca is on a distinguished road
Question Call javascript function in C#

How can i "Call JavaScript function in C# and C# function or objects id JavaScript"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-07-2006, 08:11 PM
Senior Member
 
Join Date: Apr 2006
Posts: 141
Adrian is on a distinguished road
you can define on click event, then call java script function...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-08-2006, 04:28 AM
Junior Member
 
Join Date: Feb 2006
Posts: 16
Raman is on a distinguished road
Calling Javascript method from Code behindYou can call Javascript functions as a script registered on the codebehind itself but i m not sure about your requirement. Dot net providesPage.RegisterStartupScript("key","value") method.Here, key is the name you want to give the script eg. "PageClose"value is the string .stringBuilder str = new StringBuilder()str.Append("");str.Append("window.close();");str.Append("")Then use this in the event handler you want to execute the scriptPage.RegisterStartUp("PageClose",str.ToString());This would place the javascript before the closing tag of the page thats renderedPage.ClientScriptBlock("PageClose",str.ToString());This would place the JS function after the opening
tag of the page thats renderedDepeding on your need, you can choose the method to included the script in the page when rendered at the client.Hope, this clears your query.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-09-2006, 11:16 AM
Junior Member
 
Join Date: Feb 2006
Posts: 16
Raman is on a distinguished road
any more other ways
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-09-2006, 11:19 AM
Junior Member
 
Join Date: Jan 2006
Posts: 21
Charith is on a distinguished road
there are basically 3 methods..

the very basic is to write ur java script into response.write()..

if you want to attachthe script with a web control..then in page load function controlID.attributes.add("Event","script function")

or u can try
page.registerstartupscript()

hope it'll help u out..

All the best
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.exforsys.com/forum/microsoft-net/96031-call-javascript-function-c.html

Posted By For Type Date
CodeProject: ASP.NET Discussion Boards. Free source code and programming help This question Refback 10-13-2008 04:31 PM
CodeProject: ASP.NET Discussion Boards. Free source code and programming help This question Refback 08-14-2008 02:19 PM
CodeProject: ASP.NET Discussion Boards. Free source code and programming help This question Refback 08-14-2008 02:40 AM
CodeProject: ASP.NET Discussion Boards. Free source code and programming help This question Refback 08-13-2008 12:11 PM

Similar Threads

Thread Thread Starter Forum Replies Last Post
Help me Understand the Graphics Function Allan C and C++ 2 07-13-2006 02:39 PM
Call center Requirement. mtajim Freshers Jobs 6 05-23-2006 02:17 AM
Working in call centre kalyanii2002 Freshers Jobs 10 05-22-2006 09:22 AM
Call for Referral - Walk-In-BPS kalareddy Experienced Job Seekers - India 0 06-16-2005 12:37 PM
call center jobs in delhi and gurgaon. kalareddy Freshers Jobs 0 06-05-2005 04:52 PM


All times are GMT -4. The time now is 01:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.