Friday, December 16, 2011

Confirm Message Box using C# in Web Application

To use windows confirm message box in web form at first add window namespace in your cs file.
using System.Windows;
Then add code given below to your desired place.
 
System.Windows.Forms.DialogResult dia = System.Windows.Forms.DialogResult.Yes;

if (gvOrder.Rows.Count > 0)
{
    dia = System.Windows.Forms.MessageBox.Show("Previous Order Is Not Placed Yet.Do U want to      Discard Order? ", "DELETE?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
    if (dia == System.Windows.Forms.DialogResult.Yes)
     {
    //Place Your Code Here

     }

}
else
{
    //Place Your Code Here
}

3 comments: