.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

MessageBox or?

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

Hi guys. I have textboxes about First Name and Last name and i have button called submit that insert the information from the textboxes in my database. All working fine but i want when a record( only one is possible at time) is been added to the DB to show up a message box or something like that( but i don't want a label and i will tell you why) that say record has been add successfully( i don't think those box need a button like Ok or something like that only text). Of course it can display info like Problem occurs with inserting a record. Now i want when the box show the same to disappear when user click on one of the boxes( this mean if he/she want to add another resident in my DB) or to disappear after 5 seconds or something like that?

View Complete Post

More Related Resource Links

Cutting Edge: Using Windows Hooks to Enhance MessageBox in .NET


It's fairly safe to assume that all programmers working in Windows® environments are familiar with MessageBox. The MessageBox function displays a message through a popup dialog box and lets programmers add dialog buttons and icons to the message to improve user feedback.

Dino Esposito

MSDN Magazine November 2002

Background window failed to update after MessageBox was closed on 64-bit Windows7

In vs2008, I open a WPF window as background, and then click a button in background window to open the second window. In the second window, I make it WindowStartupLocation CenterScreen and put some controls, and then click a button in the second window to close it and open a messagebox, after closing the messagebox, I find the area behind the messagebox always fails to update in the background window. code of the buttonclick from the second window: this.close(); messagebox.show("*********************")  // after closing the messagebox, the area behind it in the backgound window always fails to update. This issue can only be reproduced in 64-bit windows7 Anyone got idea? Thanks in advance. bruce

Creating messagebox in asp.net / javascript in .Net 2.0

Hi All, Could you please take time to answer me these questions? 1> Is there any type of message dialog that can be shown from pure asp.net without using javascript? 2> If answer to #1 is "no" then, I want to show a messagebox with yes/no options instead of OK/Cancel. ( Confirm shows Ok/Cancel in javascript) 3> On clicking Yes/No I want to execute server side function based on logic. How I can do that? Regards, Sushant  


Hi I am trying to pop a messagebox in a asp.net page. The framework is 2.0. This is my code below I am trying to pop a message box when I step thru the code it seems to work though no message box ever pops up   Select Case Session("model") Case "AS005" MessageBox("The model selected does not match this serial number. The serial number matches the NewLife5L please change your selection") Case "AS094" MessageBox("The model selected does not match this serial number. The serial number matches the Intensity8L please change your selection") Case "AS085" MessageBox("The model selected does not match this serial number. The serial number matches the QuietLife please change your selection") Case "AS098" MessageBox("The model selected does not match this serial number. The serial number matches the VisionAire please change your selection") Case "AS095" MessageBox("The model selected does not match this serial number. The serial number matches the FreeStyle please change your selection") Case "AS081" MessageBox("The model selected does not match this serial number. The serial number matches the LifeStyle please change your selection") Case "AS099" MessageBox("The model selected does not match this serial number. The seri

sql select results to messagebox/label

For example I want to get the price of a particular item from table items. I created the connection string and the cmd for the search and put the result in an sqldatareader. How do I put the result in a string so I can use it later?   Code so far of what I've done: (Code is in Vb.net) Dim conn =   conn As SqlConnectionNew SqlConnection("Data Source=Computer\SQLEXPRESS;Initial Catalog=database;User ID=id; password=password") Dim cmdSelect As New SqlCommand("SELECT Price FROM Items WHERE Code = Item1, conn)   conn.Open() dtrReader = cmdSelect.ExecuteReader While dtrReader.Read lblPrice.Text = dtrReader.GetDouble(0).ToString End While   dtrReader.Close() conn.Close()   Instead of the price the table is left empty.  


Hi All Im trying to display a MessageBox only if a condition is met and if the "Yes" is clicked on the messagebox then I need to execute some c# code. Heres how far Ive got:-   protected void Button1_Click(object sender, EventArgs e) { switch (Order_Status_Type) { case osIn_Complete: { ConfirmMsgBox("Do you wish to save?"); break; } case osSaved: { ConfirmMsgBox("Do you wish to save?"); break; } case osWaiting_For_Authorisation: { ConfirmMsgBox("Do you wish to save?"); break; } case osAuthorised: { break; } } } protected void ConfirmMsgBox(string message) { string sJavaScript = "<script language=javascript>\n"; sJavaScript += "var selection=confirm('" + message + "');\n"; sJavaScript += "if(selection == true){"; sJavaScript += "window.navigate('Home.aspx')}&quo

UpdatePanel, Button and Javascript Messagebox

Hi,  In my VS 2008 C# net web page, I have some TextBoxes and a Button in an UpdatePanel.The Button's click event will do the Update work to SQL Server.The Update is working, but I would like to have a message box popping out if the Update to SQL Server is successful.How do I do that?  " src="http://forums.asp.net/emoticons/emotion-8.gif">Thanks for help. Jason

WPF app never appears if showing a MessageBox during App constructor!?

My App class' constructor calls a method called initDataStructures. Here I want to load a file with data if it exists. However, as always, it's not guaranteed I can access the file - in my case, the most likely situation (it's a CSV file) is that the file is open in Excel. In this case I would like to show a dialog box, and the user can then choose to ignore the problem (and lose previously saved data) or exit the application (to try again after taking some action, such as closing the file in Excel). This code is in initDataStructures(), called from the App constructor: if (File.Exists(SubmissionsFileName)) { try { using (var reader = new CsvReader(File.OpenRead(SubmissionsFileName), ';')) { ... } } catch (IOException ex) { //string nl = Environment.NewLine; //string msg = "IOException caught while attempting to load previously recorded submissions. " // + "Press OK to ignore (lose previously saved submissions), Cancel to exit. " + nl + nl // + "Message: " + nl + nl + "{0}"; //var response = MessageBox.Show(string.Format(msg, ex.Message), "Loading error", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //if (response == MessageBoxResult.Cancel) //{ // submissions = null; // Shutdown(); //} } } If I uncomment the commented li

Displaying a Messagebox with Ok / Cancel button using C# in web application

 Hi all, I would like to get the user's confirmation by displaying a message box with ok cancel options, when you press ok it has to invoke a member function, otherwise other function. thanks. ssm.

Really weird MessageBox behaviour

I encountered some really weird behaviour with a MessageBox. As mine was a big complex app I thought it could be some complex problem, so I created a really simple app to test the problem, and it is still there. I really do not unstand this behaviour...can anybody explain it to me!

The simple app that demonstrates the problem is shown below. It is just an empty form with a single timer. The timer event handler invokes a message box. Now I would expect the message box to have modal behaviour, and thus block any further event callbacks until the dialog is closed. But it didn't, each time the handler is called, a new MessageBox was shown...that's why I added the if(TimerTicks<5) condition ;-)

So at that point I assumed that MessageBox is behaving in a non modal manner for some reason, creating new instances without waiting for button press before returning, and set a breakpoint following the show call to test this (i.e. a breakpoint on 'object foo=res').

What I found was that this line gets called **after** a dilaog button is pressed, despite the fact that the timer event handler continues to be called at each interval timeout. Whatsmore it gets called every time a dialog is closed, independently from the regular execution of the handler.

The only way

Show MessageBox of ValidationSummary from Codebehind



 I want to Show MessageBox of the ValidationSummary (ShowMessageBox="true")  from Code behind. Below is the code i used.Any tips.

Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
 Dim blnFlag = callmethod()
 If Not blnFlag Then
    ValidationError.Display("Place error message here")
 End If

End Sub

Public Class ValidationError
    Implements IValidator
    Private _errorMessage As String = String.Empty
    Private _isValid As Boolean = False
    Public Shared Sub Display(ByVal message As String)
        Dim currentPage As Page = TryCast(HttpContext.Current.Handler, Page)
        currentPage.Validators.Add(New ValidationError(message))
    End Sub
    Public Sub New(ByVal message As String)
        ErrorMessage = message
        IsValid = False
    End Sub
    Public Property ErrorMessage() As String Implements System.Web.UI.IValidator.ErrorMessage

How to display MessageBox with 'OkCancel' Button in asp.net


Hi ,

I need to display a meesage Box with OkCancel button.So when user click "Ok" button I need to do something else nothing.

My web page is with ContentPage without html tag. So i dont know where to place my java script.

But i registered it when page load. When I clicked on the save button the messageBox does not appear and

with error " Expected ';' "

Can someone advise me on this..thanks.

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim script As String = ""
        script = "<script language=javascript id='MessageBox'>" & _
                    "funcion(Save()) " & _
                    "{" & _
                    "if (confirm('Save Record')==true ) " & _

Display a form as a dialog and then display a messagebox on top


This is the code in my form1

public partial class Form1 : Form
    public Form1()

    private void button1_Click(object sender, EventArgs e)
      using (Form2 dialog = new Form2())
        var result = dialog.ShowDialog(this);
        if (result == System.Windows.Forms.DialogResult.OK)
          MessageBox.Show(this, "Test", "Test Caption", MessageBoxButtons.OK, MessageBoxIcon.Error);

And this is the code in my Form2

public partial class Form2 : Form
    public Form2()

Infopath Messagebox SharePoint Web Form



I have a requirement to display a messagebox when clicking a button on an info path form when submitting data or when a drop down list value changes.

Infopath will provide a data saved message box in a web enabled form. How do i use the same functionality to display my custom message boxes?





MessageBox.Show doesn't in 64-bit Windows 7

Sanity check - MessageBox.Show dialogs don't appear when I run my WPF app on 64-bit Windows 7, but work fine on 32-bit Windows 7. Am I forgetting to do something?

MessageBox.Show() always on screen center


Hi everyone, 

I use a MessageBox in one of the methods in my MainWindow.xml.cs, 

Although i set the Window paramter to "this", the message box always show up on the screen center no matter where the MainWindow is 


Any idea on that?

MessageBox and modal forms - move problem



I have a problem with the Windows Forms MessageBox and modal forms in general. The problem is that there is a situation where the modal form shown can't be moved.

To test this you can just make a new Windows Forms project.

1. Add a System.Windows.Timer and have it fire after a few seconds after the application is started.
2. Disable the timer in the Tick event and then show a MessageBox.

When the application runs, press the left mouse button on the main form's title bar and move the form a little (the move is not needed though). Do NOT let go of the left mouse button - keep it pressed. The timer will now fire and show the message box - which can't be moved. The message box can be moved if you do not press and hold the left mouse button on the parent form's titlebar when the timer's Tick event fires and the MessageBox is shown.

Does anyone know why the MessageBox can't be moved in the scenario above and if there is anything I can do the fix the situation?

Thanks in advance.

OS: Windows 7 Professional
Visual Studio 2010 Profesional with .Net Framework 4.0

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend