Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 13th, 2004, 08:08 AM
Authorized User
Join Date: Nov 2003
Location: , , United Kingdom.
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,

Reply With Quote
  #2 (permalink)  
Old April 13th, 2004, 12:53 PM
Friend of Wrox
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

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";

Is this what you wanted?


P2P Member
Reply With Quote
  #3 (permalink)  
Old April 14th, 2004, 02:48 AM
Authorized User
Join Date: Nov 2003
Location: , , United Kingdom.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks Snib,

That's exactly what I wanted!


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:42 PM.

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