Click here to Skip to main content
14,599,202 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a VB.NET function and i want to call it from javascript function.
How do i ?

Thanks,
Mangesh :-)
Posted
Updated 11-Jun-20 9:37am
Rate this:
Please Sign up or sign in to vote.

Solution 1

You can't - Javascript code is executed Client side and VB code is executed Server side - otherwise the client would have to download the whole of the .NET framework the first time they visited your website!

There are a few workrounds though: http://www.dotnetcurry.com/ShowArticle.aspx?ID=109[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

You can. Use WebMethods.

[WebMethods]
   
Comments
CHill60 12-Jun-20 5:50am
   
As OriginalGriff said in Solution 1 - you can't but There are a few workrounds. It is important to differentiate what is actually happening. AJAX Extensions are one such workaround be it WebMethod, PageMethod, ScriptMethod, etc ... so you have added nothing new to this 8 year old thread.
A better link by the way would have been to the actual documentation Understanding ASP.NET AJAX Web Services | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100