Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to code for confirm box in code behind file of c#.net...if i click yes it should redirect to index.aspx page if i click no it should remain in same page.can anyone help me
Posted

You need to read a BASIC ASP.NET book. You can't show UI in your code behind, as it runs on the server. Your client won't see it. You need to do it with javascript. If you need to calculate if you do it, on the server, the best way is to use AJAX to find out. Otherwise, do it on the client and redirect from there.
 
Share this answer
 
I am totally agree with Christian Graus. But we can have an alternate option for it. For a simple confirmation box we can show a ModelPopupExtender with two buttons saying Confirm and Cancel.
See a sample confirm box:
ASP.NET AJAX ModalPopup to Confirm Delete[^]


--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900