472,984 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

Pass value from javascript to vb.net to database without postback...Possible?

Hi,

I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.

What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.

Thanks in advance and I'll be happy to clarify any questions.

Andy

Nov 19 '05 #1
7 4396
You would need to do something like use XMLHTTP to issue a call to a page to
do the work. However, I think that ties you to IE 5.5 and above. This may
or may not be a problem for you.

"Andy" <ac****@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.

What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.

Thanks in advance and I'll be happy to clarify any questions.

Andy

Nov 19 '05 #2
Look at AJAX.net
It may take care of your needs in this case.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Andy" wrote:
Hi,

I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.

What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.

Thanks in advance and I'll be happy to clarify any questions.

Andy

Nov 19 '05 #3
the easiest approach is a hidden iframe/frame.

1) the src of the hidden frame should be an aspx page with hidden fields.
the clientscript would fill in the hidden fields in the frame, and do a
submit of the frame.

2) create an addtional form (nonserver) on the page with the target the
hidden frame, have the client script fill in the hidden fields in the form
and do a submit.

-- bruce (sqlwork.com)
"Andy" <ac****@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.

What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.

Thanks in advance and I'll be happy to clarify any questions.

Andy

Nov 19 '05 #4
Once you're upgraded to ASP.NET 2.0 you can use the cool new client side
callback feature to do this kind of thing.

Here's more info:
http://www.aspnetpro.com/features/20...200511so_f.asp
http://www.developer.com/net/asp/article.php/3506896

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andy" <ac****@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.

What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.

Thanks in advance and I'll be happy to clarify any questions.

Andy

Nov 19 '05 #5
if you don't need anything back, it's trivial:

var sender = new Image();
sender.src = "whatever.aspx?stufff=1&junkID=27";

Done, and done.

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Nov 19 '05 #6
Thanks everyone for their help. It seems that ajax is probably going to
be the way I go. I tried to avoid it since I'm pretty new to this web
programming and didn't understand if it was for me, but it seems that's
what I need long term. One quick question, I've been using asp.net 2.0
but because it is in its beta form, I have avoided exploiting much of
its newer features. How worried do I have to be about creating a
website in 2.0 beta then having it not work on me when the final
release comes out?

Nov 19 '05 #7
VJ
Be very worried! Well, not to scare you or anything but seriously, any new
product in beta is not going to be 100% reliable. That's why they call it
alpha, beta.
That being said, you can do a search on google for a list of issues in beta,
that way you can be aware of what's going to work on final release.

"Andy" wrote:
Thanks everyone for their help. It seems that ajax is probably going to
be the way I go. I tried to avoid it since I'm pretty new to this web
programming and didn't understand if it was for me, but it seems that's
what I need long term. One quick question, I've been using asp.net 2.0
but because it is in its beta form, I have avoided exploiting much of
its newer features. How worried do I have to be about creating a
website in 2.0 beta then having it not work on me when the final
release comes out?

Nov 19 '05 #8

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

Similar topics

7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
5
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a...
3
by: Peter | last post by:
I have a webform on this form is a User Control and another webform in IFRAME On the User Control there is a save button. I want to click this button and somehow tell the webpage in IFRAME that...
2
by: Ashish | last post by:
Hi All, I have a server runnable textbox control. I also have a server side button object but I hook up javascript to it to show a modal dialog. Upon return it places the value in the textbox...
3
by: Alfonso | last post by:
Hi: I have done a page using Asp.net with a searcher and a contact form. My problem is that it must work in navigators without javascript, and when I run de web in those navigators I have no...
3
by: vinay | last post by:
Hi All I have a page in which i using user control .on user control i using javascript to pop up a message .when i choose wrong date in user control & submits the page it alerts the message of...
1
by: kamalkns | last post by:
hi I want to pass my value from Javascript to CodeBehind Without Using PostBack urgent Plz regards kamal
3
by: Aussie Rules | last post by:
Hi, I have a few aspx (.net2) form. The first form allows the user to enter into text box, and select values from drop downs The second form needs to use these values to process some data....
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.