473,396 Members | 2,106 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,396 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 2792
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.