Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2004, 08:08 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Postback from client script

I am developing in ASP.NET and have come across a problem: I need to prompt the user with a yes / no question, which I am doing by inserting a window.confirm() script into a RegisterStartupScript command(), as this needs to be done from a server-side function. The script also writes to a hidden control whether the the user clicked on OK or cancel.

This works fine, but I need a postback to occur after the user has clicked OK so that I can carry out the process the user was prompted for. Otherwise there is no way the code can respond to this event.

Thanks for your help,
Gary

 
Old April 13th, 2004, 12:53 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Perhaps you could write a JavaScript function that takes the value from the confirm box and enters it into the address bar parameters.

<script language=javascript>
var con = confirm("Click yes to postback");
if(con)window.location="readpostback.asp?heClicked =OK";
</script>

Is this what you wanted?

Snib

P2P Member
<><
 
Old April 14th, 2004, 02:48 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Snib,

That's exactly what I wanted!

Cheers,
Gary






Similar Threads
Thread Thread Starter Forum Replies Last Post
Client Side Script Not Working sramesh ASP.NET 2.0 Basics 3 August 2nd, 2007 03:56 PM
please help ping with client side script nlicata VBScript 0 June 10th, 2004 01:44 AM
RegisterStartupScript - Postback from script gp_mk General .NET 4 April 14th, 2004 05:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.