Click here to Skip to main content
15,900,433 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i tried to get confirmation whether to add more records or not and unable to run the code

Please find my script
C#
Response.Write("<Script>if(confirm('Data updated Any more data you add ??')) "+ txtdescription.Text ="" +" ;else ;</Script>");

Please guide on this
Posted
Updated 10-Oct-13 0:01am
v2
Comments
Zafar Sultan 10-Oct-13 6:00am    
What are you trying to achieve? Please elaborate.
Thanks7872 10-Oct-13 6:01am    
I think its very much clear.
Zafar Sultan 10-Oct-13 6:07am    
Oh really? What if user clicks OK or Cancel on the confirmation dialog?
Thanks7872 10-Oct-13 6:13am    
Confirmation means what? Yes/no. It doesn't include ok/cancel buttons logically.
Zafar Sultan 10-Oct-13 7:01am    
Probably i read the wrong book. It says JavaScript confirmation dialog consists of two buttons "OK" and "Cancel". What does your book say?

 
Share this answer
 
Your code won't even compile as you have an equals sign where there should be a plus sign. It's also worth using the proper brackets with this sort of thing to reduce the risk of errors.

The following works fine for me:

C#
String doSomething = "alert('true');";

Response.Write("<Script>if(confirm('Data updated Any more data you add ??')){ " + doSomething + "}else{alert('false');}</Script>");
 
Share this answer
 
v3

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