Hi,
You can use,
a) hiddenfield to store the value of the Confirm function call
b) or a script that break the flow like the one below:
Step One:
On the client-side create a Javascript function that would show the confirm message, and based on the input would call the server side button click.
<script type="text/javascript" language="javascript">
function GetInputFromUser()
{
if(confirm("Are you sure you want to delete this?")== true)
{
//call the server side button click , from where you can trigger the actual sql code.
document.getElementById("btnDoSQL").click();
}
}
</script>
Step Two:
From the server-side, invoke the javascript function on a button click or anywhere, you need to break the flow.
protected void btnAskUser_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myConfirm", "GetInputFromUser();", true);
}
Step Three:
The ServerSide function that will be invoked on confirm : yes.
protected void gridevent()
{
//this code will be invoked from the client side script : GetInputFromUser.
//and only if he pressed 'Yes' ..i.e value == true.
}
Hope this will help you