473,385 Members | 1,958 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,385 software developers and data experts.

javascript function call a asp.net sub procedure

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>
Nov 18 '05 #1
3 5382
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

"Steven K" <sk****@troop.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP12.phx.gbl...
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>

Nov 18 '05 #2
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.

"Steven K" <sk****@troop.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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>

Nov 18 '05 #3
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.

"Steven K" <sk****@troop.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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>

Nov 18 '05 #4

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

Similar topics

3
by: ¤ Alias | last post by:
I have a function named getID3info (lvwDiscInfo.SelectedItem). What is the difference between getID3info (lvwDiscInfo.SelectedItem) and Call getID3info(lvwDiscInfo.SelectedItem) ?
4
by: Bob Murdoch | last post by:
I have an ASP application that calls a COM function to create a custom report as an Excel file. This works in a synchronous fashion, as long as the report does not take too long to create. If...
3
by: Mariusz | last post by:
I want to write function to call another function which name is parameter to first function. Other parameters should be passed to called function. If I call it function('f1',10) it should call...
15
by: Davide R. | last post by:
Ciao a tutti, vi spiego il mio problema Ho una pagina HTML che referenzia un CSS esterno. Ho alcuni elementi HTML che appartengolo ad una classe (chiamiamola "class1"). Avrei la necessità,...
4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
3
by: Steven K | last post by:
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...
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...
1
ganesanji
by: ganesanji | last post by:
Hi all, I have written a cpp prgram and a javascript function for start,stop timer. I want to integrate the timer javascript function from my cpp program. I don't know how to do it. Anybody...
2
by: =?Utf-8?B?R3JlZw==?= | last post by:
Using C# I have a web application where an ASP ImageButton is calling javascript function. How can I make the javascript function all a procedure located in my C# code behind form. In other words,...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.