Click here to Skip to main content
16,004,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need to get some confirmation from end user during execution in a Click event. and depending on it my next step will be decided. But the Pop Up message gets poped up after my click event is over. How can i make it stop till user clicks a button on some confirmation message ??..


C#
if (Session["fBudget"] != null && Session["fExceedValue"] != null)
                   {
                       fBudget = Convert.ToInt32(Session["fBudget"]);
                       fExceedValue = Convert.ToInt32(Session["fExceedValue"]);
                       if (fExceedValue < fSumActualLineTotal)
                       {
                           //Open pop up to show details.
                          // NEED POP UP HERE AND GET DECISION FROM USER??
                          // DEPENDING ON USER "OK" return TRUE
                          // and "CANCEL" return FALSE 
                       }
                       else
                       {
                           return true;
                       }
                   }
Posted
Comments
BillWoodruff 19-Sep-11 4:49am    
Need to know where the code you show is being executed: inside the 'Click event handler ?
Muralikrishna8811 19-Sep-11 5:18am    
Can you clearly specify what is your requirement.
Anele Ngqandu 19-Sep-11 6:46am    
Use modal popup extender...those ajaxtoolkit controls with javascript

Hi,

According to your requirement.If you want to wait for confirmation of user it is nothing but second request.you cannot halt request processing and binding two requests in single process.

My advice is use jquery it can helps you any situation .Let me tell you the process for your problem .first use jquery get method to get your session variables or check session variables in server side if you want confirmation thn send asynchronous response to browser which is handled by jquery.

Jquery response method show popup to user.thn if user click on ok
again send asynchronous request to server to continue you process.


I hope you understand what I said.

Step into Jquery.

All the best
 
Share this answer
 
Comments
Vishal Waman 19-Sep-11 6:35am    
Thanks

but i am new to jquery will need some to implement it..
Muralikrishna8811 19-Sep-11 6:38am    
Jquery is very easy to learn

follow this link to learn

http://www.impressivewebs.com/jquery-tutorial-beginners.pdf
if you are not using script manager in your page then write this line inside if condition..the place where u commented above

Page.RegisterStartupScript("a", "<script language='javascript'>window.confirm('your message');</script>");



hope it helps you

reply me if not works
 
Share this answer
 
v2
no actually i need return value..
true or false depending on it my next step is decided...
actually tried this approach but pop up is seen after completion of click event
 
Share this answer
 
Comments
hitech_s 19-Sep-11 5:05am    
ok i will check it out...
and one thing its an advise for you,
you wrote reply as a solution for me ...so write it as reply for that solution..plz dont mind just an advice
Apply javascript confirm method, if using Ajax then use ScriptManager.RegisterStartupScript else Page.RegisterStartupScript

C#
if(confirm("Are you sure you would like do this? ")) 
{return true; 
else 
return false;
}
 
Share this answer
 
 
Share this answer
 
v2

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