Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET .NET4
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..
 
 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 9-Aug-12 19:54pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
v2
Comments
ajithk444 at 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)

  Print Answers RSS
0 OriginalGriff 383
1 ChauhanAjay 186
2 Richard Deeming 180
3 Sergey Alexandrovich Kryukov 171
4 Yogesh Kumar Tyagi 165
0 Sergey Alexandrovich Kryukov 6,252
1 OriginalGriff 5,498
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 10 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100