Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7020117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:16:36+00:00 2026-05-27T23:16:36+00:00

I am using MessageBox class in Asp.NET with C# by imposing the namespace using

  • 0

I am using MessageBox class in Asp.NET with C# by imposing the namespace

using System.Windows.Forms
I have the following code:

/* Method for displaying the Message Box */
public void MsgBox()
{
    string message = "Do you want to modify the rate list?";
    string caption = "";
    MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel;
    DialogResult result;
    result = MessageBox.Show(message, caption, buttons);
    if (result == DialogResult.Yes) {
        Response.Redirect("PaperRateList.aspx");
    }
}

/*Calling of the above method in the following event */
protected void Save_Click(object sender, EventArgs e)
{
    CompanyMaster_Insert();
    RateList_Save();
    MsgBox();  /*method*/  
}

Now the problem is that the message box is appearing behind the form in minimized mode.and the form can be closed before closing the message bos.I want this messagebox on the form and i want to close the form after closing the message box.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:16:37+00:00Added an answer on May 27, 2026 at 11:16 pm

    MessageBox in web environment is not the best path to go, as it’s a cheap way of implementing a windows form feature.

    You have 2 ways to do this, server side (if you need to process some data) or client side (if you have all the data in the page and you can process it using javascript).

    For you particulary example, you probably have a submit button like:

    <asp:Button id="btnSave" runat="server" 
                onclick="btnSave_Click" text="Save Form" />
    

    try to add this:

    onclientclick="return confirm('Do you want to modify the rate list?');"
    

    so it ends up like:

    <asp:Button id="btnSave" runat="server" 
                onclick="btnSave_Click" text="Save Form"
                onclientclick="return confirm('Do you want to modify the rate list?');" />
    

    That’s just using a javascript method called confirm.

    To make nice MessageBox examples, and to avoid the user not to mess up with the page while the message is visible, it’s called Modal Dialog or Modal Window, try to search for it…

    jQuery UI has a Modal element that you can use, and if you fancy AJax stuff and you’re a beginner in ASP.NET, I strongly suggest you to try the ASP.NET Control Toolkit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following classes: using System; using System.Windows.Forms; namespace FastEyeControl { public partial
So I have the declaration at the beginning of my class file using System.Windows.Forms;
using System; using System.ComponentModel; using System.Net; using System.Windows.Forms; using Ionic.Zip; namespace downloader { public
Is having reference to System.Windows.Forms in a business class and using MessageBox.Show wrong? Currently
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Threading; namespace ClassLibrary { public
When I use System.Windows.Forms.Timer class and finish using it then I can't disable it..
Im using System.Windows.MessageBox.Show() to display a dialog to the user. One overload lets me
I have a function like this defined in one class: using System; using System.Collections.Generic;
I'm using the MessageBox class to show errors to users, and while that might
I have an MDI application. When I show a message box using MessageBox.Show(), the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.