Confirmation dialogue box
I am having button on its click event I am calling some function that function is interacting with database and fetching some result and on basis of that result I have to pop confirmation box and on basis of that ok or cancel click I want to execute my same function further.how can I do this.


Dhanunjay Jajimoggla100 reputationPosted Jun 18, 2014, 8:46 PM EDT
Before onclick event, you have write the following code.
function Confirmation()
{
if (confirm("You Sure,To Get Data !") == true) {
return true;
}
else
{
return false;
}
}
gunjan aroraRank #8,160 · 227 reputationPosted Jun 18, 2014, 9:43 PM EDT
Dhanunjay Jajimoggla100 reputationPosted Jun 19, 2014, 2:48 AM EDT
Please Provide some code
gunjan aroraRank #8,160 · 227 reputationPosted Jun 19, 2014, 7:56 PM EDT
{
for(int i=0; i< datatablecol; i++)
{ string qry="select qry";
int res= result from that query;
if(res=="0")
{
confirmation box pop
if(user click yes) { }
else { }
if(res==1)
{
confirmation box pop
if(user click yes) { }
else { }
}
} } } }
This is a sample code...I want my function should not execute further unless and until user don't provide the confirmation.
Dhanunjay Jajimoggla100 reputationPosted Jun 20, 2014, 9:16 PM EDT
Try this,
Button2.Attributes.Add("onclick", "return confirm('Are you sure you want to proceed?')");
if above code is not working ...Again try like below.
1. Add the reference of win form .dll
2. here write code like
if (MessageBox.Show("Are you sure you want to proceed?", "proceed", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
//write your logic
}
Best Regards,
Dhanunjay.
gunjan aroraRank #8,160 · 227 reputationPosted Jun 22, 2014, 10:07 PM EDT
Dhanunjay Jajimoggla100 reputationPosted Jun 23, 2014, 7:22 AM EDT
Try this,
StringBuilder sb = new StringBuilder();
sb.Append("");
Page.RegisterStartupScript("ConfirmStatus",sb.ToString());
gunjan aroraRank #8,160 · 227 reputationPosted Jun 24, 2014, 7:35 PM EDT
Dhanunjay Jajimoggla100 reputationPosted Jun 25, 2014, 10:49 PM EDT
Hi,
The above code placed in one method.
public bool Test()
{
return true;
or
return false;
}
In your method, Handle with the if condition .