473,573 Members | 2,835 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 8959
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
3277
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
1610
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
1419
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
2747
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...
3
5204
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...
1
2090
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 . ...
2
3250
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...
6
2238
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
10852
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
7781
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...
0
8027
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. ...
0
8202
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7788
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...
0
8066
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6421
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5594
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...
0
5292
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...
1
2216
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

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.