Calling C#/VB.Net function in Javascript

T

Tanmaya Kulkarni

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
 
A

Ankit Aneja

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top