473,325 Members | 2,442 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,325 software developers and data experts.

Calling C#/VB.Net function in Javascript

Hi,

I have a web application where I need to call backend C#/VB.Net functions
from javascript.

Is it possible..and how?

Thanks,
Tanmaya
Jun 20 '06 #1
3 2786
when is javascript function called if it is called from aspx page itself
like we do for client side validation then it itself goes to codebehin if
true is returned
like
<asp:button id="cmdsubmit" Runat="server" Text="Submit"
OnClick="checksubmit()"></asp:button>
then on submitting javascript function will be called and if every thing
validates function associated with this submit button in code behind will be
called
function checksubmit()
{
if(document.generalinfo.elements["firstname"].value=="")
{
alert("Please enter First name ");
return false;
}
if(document.generalinfo.elements["lastname"].value=="")
{
alert("Please enter Last name ");
return false;
}

if(document.generalinfo.elements["addrline1"].value=="")
{
alert("please enter your Address");
return false;
}

if(document.generalinfo.elements["city"].value=="")
{
alert("please enter your City");
return false;
}

if(document.generalinfo.elements["state"].value=="")
{
alert("please enter your State");
return false;
}

if(document.generalinfo.elements["country"].value=="")
{
alert("please enter your Country");
return false;
}

if(document.generalinfo.elements["pin"].value=="")
{
alert("please enter your Pin");
return false;
}
if(Validatephone()==false)
return false;
}

but if ur scenario is different than i can't say

"Tanmaya Kulkarni" <ta**************@persistent.co.in> wrote in message
news:u5**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a web application where I need to call backend C#/VB.Net functions
from javascript.

Is it possible..and how?

Thanks,
Tanmaya

Jun 20 '06 #2
You can do it by using callbacks in ASP.NET 2.0
Tanmaya Kulkarni wrote:
Hi,

I have a web application where I need to call backend C#/VB.Net functions
from javascript.

Is it possible..and how?

Thanks,
Tanmaya


Jun 20 '06 #3
use __doPostBack function of javascript
Note: There Is two underscore "__"
Tanmaya Kulkarni wrote:
Hi,

I have a web application where I need to call backend C#/VB.Net functions
from javascript.

Is it possible..and how?

Thanks,
Tanmaya


Jun 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
4
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
13
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
6
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
2
by: moni | last post by:
Hi, I wanted to call a javascript function function showAddress(address) { ..... } from the aspx.cs file from the Gridview_RowCommand function
1
by: Memphis Steve | last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file? Here are the two scripts I want to use with the...
15
by: Sampat | last post by:
Hi, I wanted to know the performance of calling a function pointer v/s a normal function call in javascript in a scenario where there are multiple calls in the js to the same function. Please...
9
by: mrcheeky | last post by:
Hi, I'm stuck, but it's almost working! From a html page, my javascript calls a server-side php script. The php reads a value from a server-side .txt file and passes it back as a javascript...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.