473,382 Members | 1,512 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,382 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 5379
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...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.