Call javascript function from VB function?

Can I call a javascript function from inside a VB function/sub?

I would like to call a javascript function that refreshes the parent page after a record has been inserted into a database.

I have the javascript function I just dont know how to call it from a vb function/sub?

 Any help would be awsome

0
captain_salad
4/23/2009 10:22:20 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1152 Views

Similar Articles

[PageSpeed] 41

 You can't call client methods from server code, only the other way around. Unless your insert is a very long operation, the best idea is just to do the insert as normal. i.e. perform the insert on postback, then allow the page markup to render as normal.


My Blog
0
booler
4/23/2009 11:24:25 AM

 

captain_salad:

would like to call a javascript function that refreshes the parent page after a record has been inserted into a database.

I have the javascript function I just dont know how to call it from a vb function/sub?

If (Data is Inserted) 

{

    RegisterScriptBlock(this.GetType(),"a","YourJSFunction()",true);


We All move to our original place.
Don't forget.

Imran Baloch
0
imran_ku07
4/23/2009 11:42:25 AM
Reply:

Similar Artilces:

Acessing variables, objects and functions from javascript to VB .NET Web Forms
I have included some javascript files in my vb.net application. I want to access the variables, objects and functions of Javascript to the VB.NET Web Forms, which means that I want to transfer the methods from Javascript to the code-behind in a web form. How do I do this? Can anybody help me with some sample codes...thanks in advance . you can't pass javascript variables (client side) to code-behind (server side). you can however put your variables into hidden input fields then access those input fields from code-behind. or use ajax I think the only way to do this is...

Acessing variables,arrays, objects and functions from javascript to VB .NET Web Forms
I have a textbox where user can put data.I store data into an array .I did this with java script.now i want to acess the array from the Codebehind  in vb.net web pages.here is the codefunction MakeArray( n ) { if( n <= 0 ) { this.length = 0; return this; } this.length = n; for( var i = 1; i <= n; i++ ) { this[ i ] = 0; } return this; } var Form1 = new MakeArray( 25 ); var index = 0; var cmmnd = 1; function f_store( sTR ) { var i; if( index >= Form1.length ) { for( i = 1; i < Form1.length; i++ ) Form1[i-1] = Form1; index = Form1.length - 1; } Form1[ index ] = cmmnd + ":" + sT...

calling a javascript function from VB.net
Hi, does anyone know how to call a function written in javascript in a .js files using vb.net without doing it on events. I just want to call them when i need them and not during events(onchange, onBlur...etc) Thank you so much in advance..  Take a look at my post on ClientCallbacks here : http://forums.asp.net/t/1118172.aspx   Eric...

Call JavaScript function from VB.NET
Hi again, do you know how can I call a javascript function from the server side in VB.NET? Thanks!! You can't call Javascript functions directly form the server but you can get a script to run when the page loads on the client: Put this in your Page_Load event: Page.RegisterStartupScript("popup", "<script>alert('Message Saved');</script>") Modify it to call whatever function you want. Hope this helps, Nic...

How to call javascript function in .NET VB code?
I tried to call js function as below in .NET VB code, but it did not work. No error, no response.  Page.ClientScript.RegisterStartupScript(Me.GetType(), "myfunc", "alert('aaa');") Hi,Try this:this.ClientScript.RegisterStartupScript(this.GetType(), "showmessage", "alert('Hello World');", true); //last parameter will add the script tags automatically.Hope this helps. Best Regards,RajaMCAD .Net, MCDBAPlease choose "Mark as Answer" for the post that leads you to a solution Thanks for response. Page.ClientScript....

how to call Javascript function from VB.net but not onclick()
 Hi, I'm just wondering how can I call a function that is written in Java Script from a VB.net page? I know that I can add it to the onclick event of a button, but the thing is I want to call the javascript later on in the code and not instantly when I click the button.. is there a way?   On a page load event you can just use: btn.Attributes.Add("onclick", "MyFunction()")Please mark anything that helped you out as an answer.   dubsdj: Hi, I'm just wondering how can I call a function that is written in Java Script from a VB.n...

how to call vb.net functions or procedures from javascript?
Can anyone please tell me how to call vb.net functions or procedures from javascript? You cannot directly call serverside ASP.NET methods if thats the question.Mike Schellenberger - MCAD You can, however get client-side code to raise server-side events on existing controls... Page.GetPostBackEventReference(ControlOfInterest)...

Is it possible to call a VB.NET function in javascript?
Hi, In this code I show an alert. But instead of the alert it has to do a function. Since it's not possible to connect to an sql database with javascript I need to do this in a function in my VB script section.That function I would like to call in my javascript when my javascript function is called. Here is the javascript code:function GetKeyPress() { alert(window.event.keyCode) }   Many thx in advance !! Hi, I hope you meant VB.NET and not vbscript. Check a post of mine over here How to call Server Side function from Client Side Code using PageMethods in ASP.N...

Call VB.NET existing function or using Javascript ..or....
 Hello All, I'm new to programming and would appreciate some much needed help. I have hit a wall with one of the issues. Basically first the overview and then the nitty gritty details. I am working on .NET Framework 1.1 and using VB.NET. I had an existing ASP.NET grid in a user control which I have replaced using a third party AJAX Grid (Component Art) instead. Implementing the grid was very easy and up until now it has been a pretty smooth ride. However, now I have one column (out of 8 total) which displays a small table when your mouse hovers over it (in the original ASP.NET ...

VB.NET
Hi, I've been looking for a solution for a while now and haven't been very successful so hopefully someone can help me out here. I have a timer on my aspx page which starts at 4 hours and goes all the way to 0 hours 0 minutes and 0 seconds remaining. I need to call a function in my code behind when there is only 1 hour remaining.How can i call this function from javascript. I hope someone can help me out. Thanks in advance!Ravina BrarSoftware DeveloperUniversity Of Alberta--------------------------The man who smiles when things go wrong has thought of someone to blame it on. - Rob...

Passing a varible to A Javascript Function call... (vb.net)
Good Morning all, Using: VS2008 I have been working with web services/master pages and incremental page updates (from the HDI video). I now wish to extend the code I have by passing a variable to a function. Every way I have tried doesn't seem to work. The service method is defined as below: Function GetSomeStuff(ByVal str as String) As String And the js code is here: ret = SiteService.GetSomeStuff("", OnCompleteContent, OnTimeOut, OnError); Basically, myvariable is the path of the page, so basically in my case "AthDevProject/Default.aspx". I h...

call javascript function from code behind with vb.net
I have a javascript function in the head section of a form. From the code behind of this form, I want to call the function with vb.net. How do I do this? Thanks. Page.RegisterStartupScript.Bertrand----This posting is provided "AS IS" with no warranties, and confers no rights....

Call c# function from javascript function
This is my code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <%@ Import Namespace="System.Web.Services" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script runat= server> [WebMethod] public string GetName() { return "Hello Word"; } </script> <script language=javascript type="text/javascript">...

calling a javascript function from a c# function
Hi,I'm using asp.net, c# framwork 1.1 and some javascript.I have a table in which there are 3 cells.In each cell there is a control.In the first cell the control ID is DropDownList1 and the items are Item1, Item2 and Item3.In the second cell, the control ID is TextBox2.In the third cell, the control ID is TextBox3.What i am trying to do is :If DropDownList1 selected value equal Item1   then hide the second AND the third cells.If DropDownList1 selected value equal Item2   then show the second cell AND hide the third cell.If DropDownL...

Web resources about - Call javascript function from VB function? - asp.net.web-forms

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

JavaScript - Wikipedia, the free encyclopedia
programming styles. JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
... editor - report abuse/spam - help the entire directory only in Tools/Obfuscators Description Top : Computers : Programming : Languages : JavaScript ...

Facebook Open-Sources JavaScript Static-Type Checker Flow
The latest software to be open-sourced by Facebook is Flow , a static-type checker for JavaScript . (more…) New Career Opportunities Daily: ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript
The Facebook SDK for JavaScript provides a rich set of client-side functionality for adding Social Plugins, making API calls and implementing ...

Facebook App Devs Get Javascript
It has been an oft-lamented fact of the Facebook Platform thus far in its life that, in order to use all but the most simple of Javascript functionality–the ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 1/3/2016 2:46:30 PM