473,781 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To: Popup Confirmation Dialog & Redirect in LinkButton_OnCl ick

How To: Popup Confirmation Dialog & Redirect in LinkButton_OnCl ick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnCl ick event, I need to do some
processing and, if it succeeds, popup a confirmation dialog and redirect to
a different page. How can I do this?

Here's some pseudo-code:

LinkButton_OnCl ick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redire ct("nextpage.as px", true);
}
else
{
// Handle
}
}

Thanks!
Feb 14 '06 #1
2 8995
You could use the JavaScript "confirm" method as demonstrated here, or you
could just use the confirmation button control I've provided:

http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://Steve.Orr.net

"steggun" wrote:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnCl ick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnCl ick event, I need to do some
processing and, if it succeeds, popup a confirmation dialog and redirect to
a different page. How can I do this?

Here's some pseudo-code:

LinkButton_OnCl ick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redire ct("nextpage.as px", true);
}
else
{
// Handle
}
}

Thanks!

Feb 14 '06 #2
Steggun,
You cannot do this in a server side codebehind event handler as the page has
already posted back and is running back through IIS on the server. There are
workarounds however.
You could either use some client-side javascript to handle the onclick event
and popup a window with a quasi-confirm in it, capture the
window.returnVa lue, and then perform a conditional redirect by setting the
window.location .href of the parent page to the new page.

Or, you could just have the server side code do a server.Transfer to an
interstitial confirmation page that uses the META refresh construct to have a
timed reload but with the target being the final page.

Just some ideas.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"steggun" wrote:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnCl ick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnCl ick event, I need to do some
processing and, if it succeeds, popup a confirmation dialog and redirect to
a different page. How can I do this?

Here's some pseudo-code:

LinkButton_OnCl ick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redire ct("nextpage.as px", true);
}
else
{
// Handle
}
}

Thanks!

Feb 14 '06 #3

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

Similar topics

2
3290
by: QA | last post by:
http://www.popupcheck.com/popup_manual/modeless.asp can still have a popup even when I have a popup blocker - google toolbar. I want to know the technology, but I can not read the source code. Anyone knows the trick to get around the blocker?
2
1617
by: Marco Antonio Montalvo Durán | last post by:
hi for example, I have a page 'register.aspx' and open a second page 'popup.aspx', what I want to do is to pass the control and values obtained in 'popup.aspx' to 'register.aspx', somebody help!!! thanks
0
1428
by: ApexData | last post by:
I Want Access FIND&REPLACE to stay in FIND mode. Can I place the (Access FIND&REPLACE Dialog) in a popup/modal dialog form? I need to control this process to prevent the user from pressing keys on the MainForm that will cause the Forms AllowEdit to become True, in-turn putting REPLACE back on! I DONOT want this to happen.
3
2773
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of the two buttons. Once the user clicks on the linkbutton a javascript dialog box popsup that says "Is the Lessee buying this vehicle?" and with two buttons "Yes" and "No". If user clicks "yes" it should go to DealerQuestions.aspx" and if "No" it...
3
5219
by: ApexData | last post by:
I am using code from the following links to establish a Browse File and Browse Folder dialog. http://www.mvps.org/access/api/api0001.htm http://www.mvps.org/access/api/api0002.htm This code works great. However, once the file dialog becomes visible, if the user clicks on my popup form that exists under the file dialog, the file dialog disappears under the form. Then, when the form clears, the file dialog shows. Select a file, and...
1
2101
by: Orit | last post by:
I have a question regarding usage of AJAX Control Toolkit's Popup Control Extender . I am using the Popup Control Extender to display a popup dialog ( panel ) from my asp.net page on click of a button. However , I need to display this popup only if some statement is TRUE , otherwise I will update database and redirect to another page . How can I do this ?
2
3268
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button once, a white window the size of my webpage displays. I close it and click on the button again (for...
6
2249
by: thesinnerishere | last post by:
hello! how can the save task be completed when the popup is closed in javascript. for eg i have this save function. so when i click on the OK of confirmation dialog box , the popup should also close and the save task should be completed.i am working with asp. even if i use onunload or unbeforeunload it doesn;t work any suggestions???
5
10880
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi all Have a couple of issues with the modal popup extender (asp.net 3.5, vb.net, visual studio 2008): I have created a user control (e-mail enquiry form) which is designed to accept text input then send an e-mail. The user control has 2 views – view 1 –e-mail input form, view 2 confirmation that e-mail has been sent.
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.