Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if user click on OK button then data get updated in database and if user click on cancel button data not updated in database.
this confirmation message for gridview updation..please help me
Posted

The simplest way is using
JavaScript
window.confirm(message);

http://www.w3schools.com/jsref/met_win_confirm.asp[^]
This is not standard but implemented in all browsers.
In fact there is no standard for this - however if you do some Google (in case that window.confirm not fit) you will find a lot of solutions...
 
Share this answer
 
try this js function:-
C#
function confirmSave() {
    var ans = confirm('Do you want to save this data?');
    if (ans == true) {
        return true;
    }
    else {
        return false;
    }
}


and write
OnClientClick="return confirmSave();"
in your buttonfield.
 
Share this answer
 
v2
Refer - Asp.net Delete gridview records with confirmationbox example[^].

It shows example for Delete operation. Try to replicate the same behaviour for Update.
 
Share this answer
 
C#
function load(){
var res =  window.confirm("How Are You ?");
 if(res){
code to update the data in database.
}
else{
do something else
}
}


call this function from wherever you want to call.
 
Share this answer
 
v2
Comments
CHill60 14-Feb-14 9:49am    
OP wants Yes No confirmation not just ok

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