Dialog Box in ASP.NET


New member
Mar 15, 2005
Programming Experience
Hello Everyone,

I am new to ASP.NET and I have this certain problem of converting a VB.NET application to an ASP.NET application. The application allows a user to enter certain employee details. These details are stored in a database. Now if theres a primary key violation(i.e. in this case Employee ID) then a dialog box pops up saying 'Employee ID' already exists and whether or not the user wants to update the details of this existing employee or not. The snap shot of my VB.NET code is as follows:-

If dr.HasRows Then
Dim drQuit As DialogResult
drQuit = MessageBox.Show("Employee ID already exists, to make updates to this Employee ID press OK, else press CANCEL and enter a new employee ID to add the details of a new employee", "Exit Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2)
If drQuit = DialogResult.OK Then
extra code goes in here
extra code goes in here

Please do suggest as to how do I implement the same in ASP.NET i.e. if there is a primary key violation how do I provide a dialog box in ASP.NET and how do I place this code in .aspx.vb page. Please do explain in detail as I am a beginner

Thanks so much in advance

Top Bottom