473,657 Members | 2,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 4854
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
You would have to use the Page.RegisterCl ientScriptBlock 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
maria80e
12 New Member
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
4826
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 javascript: <script language="javascript"> var sessionServer = "<%#jsTestServer%>"; alert(sessionServer); </script>
0
1284
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 "~" so I can have a relative path to my page. So here is the javascript function: function showHelp(fieldID) {
3
1667
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? thanks, rodchar
5
1920
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 = CreateReportOnRuntimeDS(Rs, svReportFile, svTTXFile, False, True)" saying that, "Object reference not set to an instance of an object." Can any one help me out to solve this problem. Module Report Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" (ByVal
3
13605
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 passed to this user control. How do I (or from where do I) call this function? I tried several ways like: this.Attributes.Add("onLoad", "javascript:openDoc();"); in the page_load / page_prerender etc...
5
2579
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
11522
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 function whether i click the link then i tried this (using forms)
6
9554
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 = 'http://www.blah blah blah.com'; But when I try to set an event handler this way, as shown below, it fails. parent.ToolMenuFrame.window.document.body.onload = "alert('On Load Trigger Fired!!');"; parent.ToolMenuFrame.document.body.onload = "alert('On Load...
4
38644
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
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.