Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Got Some error according the code. i think im missing some library class.Please help. Thanks

C#
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
using System;
using System.Text;




public partial class BackUp : System.Web.UI.Page
{
    SqlConnection con;
    SqlCommand cmd;
    SqlDataReader dread;


    protected void Button2_Click(object sender, EventArgs e)
    {
        if (File.Exists(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\PatientHistory.bak"))
        {
                      
            if (MessageBox.Show(@"Do you want to replace it?", "Back", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
               File.Delete(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\PatientHistory.bak");
            }
            

    }

}

}

Posted
Updated 7-Oct-12 18:27pm
v2
Comments
[no name] 7-Oct-12 22:29pm    
And what would "some error" mean exactly? You do realize of course that the messagebox will be displayed on the server and not on the client side right?
coldspray 7-Oct-12 22:37pm    
so i need to create a custom messagebox to display one client side???
it show"The name 'MessageBox' does not exist in the current context
". How can i solve it then?
[no name] 7-Oct-12 22:39pm    
I think that the most popular method is use ajax. You could also go with javascript. You have to use a client side scripting method of some kind.
coldspray 7-Oct-12 22:42pm    
Thanks for help! =)

1 solution

I dont think you can use MessageBox on an ASP.NET Application.

Try using a javascript alert / confirm command..
 
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