473,769 Members | 5,823 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 8992
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
2100
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
3267
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
2243
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
10043
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8869
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
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
6672
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
5298
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...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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.