473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to Call Javascript funtion in a VB.net Code behind

Hello .Net Wizards!

I would like to seek your help on how to call javascript function from code behind of VB.net. I have javascript function named Openform() and i want to execute it on page load, if not page.ispostback...

I know how to do this on javascript (on load attribute on the body of html), what i want is to execute the javascript function through vb.net code behind...

Thanks a lot....in advance.
Feb 26 '08 #1
2 4814
Shashi Sadasivan
1,435 Expert 1GB
You would have to use the Page.RegisterClientScriptBlock method, and pass the javascript function as a parameter

You would not need the function to be explicitly written in the .aspx page, but needs to be stored as a string in your code which will be passed tot he method above
Feb 26 '08 #2
Could you please explain in detail with example?
Mar 6 '08 #3

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

Similar topics

8
by: Jade | last post by:
I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarname publicpropertyname %> but it doesn't seem to work. I have this piece of code here in...
0
by: nic | last post by:
Hi, I need to get the equivilent of Response.Redirect (~/mypage.aspx) for a dynamic javascript function. Essentially I am writing the javascript on the non-code behind page and need to inject the...
3
by: rodchar | last post by:
hey all, i have a server-side button on my webform and was wondering if i can call an external javascript that's in the same application direcory? If so, can someone please show me the syntax? ...
5
by: Peri | last post by:
Dear All, In VB 6.0 declaring this function and calling this functions works smoothly. But in VB.NET or ASP.NET (Code behind), I am getting an error in the line "HResult =...
3
by: anadimpa | last post by:
Hello all I build a javascript function string in the code behind and register it in the Page_Load of my User Control. I do this because I build the javascript based on some variables that are...
5
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
6
by: pronerd | last post by:
Hi, I am trying to dynamically set an event handler across frames. I have no problems setting properties across frames doing something like parent.ToolMenuFrame.location.href =...
4
by: sajithkahawatta | last post by:
i want to call a java script function from code behind. in page1.aspx page i placed script' <script language="javascript"> function SetSelected() { infoTextBox.select(); } </script>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.