473,396 Members | 1,998 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 VB.NET CodeBehind From a Javascript on ASP.NET webpage

Hey all, just wondering if the subject of this post is possible. I
have a javascript on my asp page that detects browser onunload, and it
will successfully popup a messsage box. When I try to call a sub in my
codebehind, the sub never fires, and I receive no errors.

I've also tried unsuccessfully to take advantage of the application_end
and session_end sub's in the global.asax, but neither would work
correclty.

In case it matters, the sub in my codebehind simply queries an sql
database, and emails the information to my sales dept.

Thanks!

Nov 21 '05 #1
1 1438
Hi,
Hey all, just wondering if the subject of this post is possible. I
have a javascript on my asp page that detects browser onunload, and it
will successfully popup a messsage box. When I try to call a sub in my codebehind, the sub never fires, and I receive no errors.


You can't call a serverside sub in your client JS/VBS. Remember that at
the point client scripts execute, there's already no codebehind, and no
serverside code, so you just can't call them.

Maybe, you could open a pop-up window in unload event with some server
page, and execute your proc in it, but to my mind, it isn't a good idea.

Roman
Nov 21 '05 #2

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

Similar topics

3
by: nazim | last post by:
Hi, As a real novice trying to get to grips with c#.NET and html. I have created a simple showdialogbox which is called from within a webpage.aspx, I pass values to it from the main page and i...
2
by: exshige | last post by:
I read from some book that you can actually on any tag in the html page put a onClick or something and assign it with the sub/function name that is in the codebehind. I tried but it say name...
2
by: Ekken Zuiber | last post by:
hiye people, i know this have been ask multipletimes over the past year, but i cant find any here in the new group so here goes.. in my code behind, i'm going to do some validation and use...
1
by: Antoine | last post by:
I have a pretty quickish question about ASPX with codebehind. I have done an exhaustive search of the web so no go there. I was hoping to reach out for some help here. Anyway, I have a really...
1
by: batista | last post by:
Hi, I'm using webservice.htc to call a non-secure(without https) webservice method from a webpage. Now, if the webpage is not under https then everything works fine. But, when enable ssl in...
3
by: Zeez | last post by:
Hi all, I have a webpage that calls a webservice found on a remote computer. Below is the code of my webpage: ===================================== <html> <head> <script...
7
by: =?Utf-8?B?Qw==?= | last post by:
I have a dropdown list as below. I add an onchnage attribute in my codebehind to call some Javascript. I want to get the selected text from my dropdown. What am I doing wrong below? ...
2
by: Adrian | last post by:
Hi all of the PC that will have access to the ASPX page have a COM object installed and using Codebehind I add a COM reference to it and I can call it like this: View.ViewSrv vs = new...
1
by: ahmh | last post by:
The javascript function is called getsportart2 in the codebehind page_load I have the following Page.RegisterStartupScript("MyScript3","<script type='text/javascript'...
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
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:
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...
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
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.