473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick

How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnClick 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_OnClick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redirect("nextpage.aspx", true);
}
else
{
// Handle
}
}

Thanks!
Feb 14 '06 #1
2 8947
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_OnClick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnClick 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_OnClick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redirect("nextpage.aspx", 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.returnValue, 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_OnClick
Hello All,
I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the
server-side code for the LinkButton_OnClick 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_OnClick()
{
// Process code
// Check for success
if (success)
{
// Popup confirmation dialog stating that the process succeeded
// [user clicks Ok on the dialog]
Response.Redirect("nextpage.aspx", 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
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....
2
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...
0
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...
3
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...
3
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...
1
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...
2
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...
6
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...

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.