javascript function call a asp.net sub procedure

  • Thread starter Thread starter Steven K
  • Start date Start date
S

Steven K

Hello,

Can you call a vb.net procedure inside a JavaScript function? For example I
need to validate 20-30 fields using JavaScript and if everything flies, run
a vb.net procedure:

<script language="JavaScript" type="text/JavaScript">
function frmValidate(theForm)
{
strName = theForm.RequestType;
strValue = strName.value;
if (strValue == "None Selected")
{
alert("Please select the type of request you are submitting in the
\"Request Type\" field.");
strName.focus();
return (false);
}

</script>
 
The usual way is to submit the form (ie doing a "postback" using .NET
terminology) as the JavaScript is client side while your .NET sub is server
side...

Patrice
 
You can either do a post to a page (same or different).

You could also look into using the Microsoft.XMLHTTP object, which allows
you to programmatically post to a page and pass it parameters - and then get
a result back using javascript.
 
If you want call Server side function from client side JScript you can use
WebServer.htc behavior. If both JScript & .Net code on client side you
should wrap you .Net code into COM.
 
Back
Top