Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
How can call confirm message box on server side button click event because I want to perform some operation if user click on 'ok' button else execute other code if it click on 'cancel' button.

thank you.
Posted
Comments
Karthik_Mahalingam 12-Jan-14 1:16am    
post your code,
what you have tried ?
GANESHGITE 12-Jan-14 1:35am    
Hi Kartik,
Please check the code...

protected void Button1_Click(object sender, EventArgs e)
{

TestingServiceClient client = new TestingServiceClient();
client.TestCompleted += (cs, ea) =>
{
if (ea.Error == null)
{
this.TestResult = ea.Result;
if (TestResult == 1)
{
//Confirm messager box do you want to perform this operation??
//if(confirm.result=="OK")
//response.redirect("transactionpage.aspx");
//else
//return;
}

else
{
//datetime dt =System.DateTime.Today;
////Confirm messager box do you want to perform this operation??
//if(confirm.result=="OK")
//{
//ServiceCall1
//}
//else
//{
//ServiceCall2
//}
}
}
}

client.TestAsync(int a);
}
Karthik_Mahalingam 12-Jan-14 1:44am    
it doesnt make sense to call confirm box from client side, any how you wont be able to get the confirm result in the same code sequence. you have to trigger another event to execute the same in server..
GANESHGITE 12-Jan-14 1:47am    
Can you please send me any demo example.. so I can implement it in my code.
Karthik_Mahalingam 12-Jan-14 1:50am    
check my solution

1 solution

Try this code,
it will help you..

C#
string script = " if  (confirm(' do you want to perform this operation???')) window.location='transactionpage.aspx'";
           Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", script, true);
 
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