Click here to Skip to main content
15,895,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
 for (int j = 0; j < noOfdays; j++)
 {
//check record present or not
  int attCount = ............;
//record is not there
  if (attCount == 0)
   {
     //here i have written insert code to data base                     
   }
//record present
   else
   {
   //here i wana show confirm box(do you wana override the existing record?)
    // ** if yes then i override the record by a function call,then continue the loop again.
     //** if no then the loop will continue
   }
  }
Posted
Updated 18-Mar-14 6:59am
v2

C#
for (int j = 0; j < noOfdays; j++)
 {
//check record present or not
  int attCount = ............;
//record is not there
  if (attCount == 0)
   {
     //here i have written insert code to data base
   }
//record present
   else
   {
      if (MessageBox.Show("do you wana override the existing record?", 
            "Confirm!!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes){

            // override the record by a function call,then continue the loop again.
        }

   }
  }
 
Share this answer
 
This small snippet should get you started on what you are after.

C#
DialogResult dr = MessageBox.Show("Are you sure you want to exit?", "Exit Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
    this.Close();
}
 
Share this answer
 
Comments
Arup(Software engineer) 18-Mar-14 8:47am    
But here i have asp.net web application... then how can i do that?
Simon_Whale 18-Mar-14 8:50am    
firstly I would suggest that you edit the tag in your message so that people now you are using web based solutions instead of desktop.

secondly have a read of this http://stackoverflow.com/questions/1391979/how-to-show-a-message-box-in-an-asp-net-page
Arup(Software engineer) 18-Mar-14 9:05am    
thank you for your suggestion.i show the link which you suggested me, but here i have a different requirement. and i need confirm box inside for loop.and i had written System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "confirm('Do You want to override the record');", true);
but this will come after loop complete.So kindly help me what can i do..
C#
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "confirm('Do You want to override the record');", 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