Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have hosted my web application on iis in my machine.In my page i have a delet button in myy gridview.When i click delete i needed a confirmation message,so i wrote this code.But unfortunately i get this error here. what is the solution for my error.help me friends..

C#
protected void DeleteRecord(object sender, GridViewDeleteEventArgs e)
   {
       if (!IsPageRefresh)
       {
           string id = gridRegistrationTableDetails.Rows[e.RowIndex].Cells[2].Text;
           if (MessageBox.Show("Are you sure to delete the record?", "Delete Employee Record.!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
           {
               deleterecordMethod(id);
               BindData();
           }
       }
   }

Pls post me solution for this...
Posted

1 solution

MessageBox is for use within windows (as opposed to web) applications. It would attempt to open a message box on the server. This is not allowed so that application errors.

To show a message on the client you would need to use JavaScript - such as alert("message").

Check this discussion, hope it solves your issue:
http://forums.asp.net/t/907491.aspx/1[^]
http://stackoverflow.com/questions/1030891/error-while-showing-a-modal-dialog-box-or-form[^]
 
Share this answer
 
v2
Comments
ajithk444 10-Aug-12 2:37am    
thanks fr ur help..!

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