Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How Do You Create a Popup Window in C#?

Posted on 2011-09-13
11
Medium Priority
?
394 Views
Last Modified: 2012-05-12
How do you create a popup window in C#?

Thanks,

Dan
0
Comment
Question by:danielolorenz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36531028
WinForms or WebForms?

Can you elaborate more on what you consider a "popup" window to be and/or contain?
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 360 total points
ID: 36531051
The following would display a custom windows form (called myform) as a modeless window.
myform.Show();

Is that what you wanted ?
0
 

Author Comment

by:danielolorenz
ID: 36531107
a myform would be perfect.

How do you import?  It does not recognize it.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:danielolorenz
ID: 36531109
I could also use WinForms if you show me how to use it.
0
 

Author Comment

by:danielolorenz
ID: 36531132
This is a small popup for a web application
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 360 total points
ID: 36531143
OK, I'll repeat my comment with a small change

The following would display a custom windows form (called YourCustomFormNameGoesHere) as a modeless window.
YourCustomFormNameGoesHere.Show();

Is that what you wanted ?



YourCustomFormClassNameGoesHere YourCustomFormNameGoesHere = new YourCustomFormClassNameGoesHere();
YourCustomFormNameGoesHere.Show();

Open in new window

0
 

Author Comment

by:danielolorenz
ID: 36531169
Yes, this is what I want.  It is for a web application.  How do you code this from scratch?
0
 

Author Comment

by:danielolorenz
ID: 36531170
I am getting an error
0
 
LVL 9

Assisted Solution

by:BlueYonder
BlueYonder earned 780 total points
ID: 36532126
Ajax may be your best option.  Download ajax from http://www.asp.net/ajaxlibrary/download.ashx.  Follow the tutorial for the modal popup.  http://www.asp.net/ajaxlibrary/act_ModalPopup.ashx.  Add <%@ Register Assembly="AjaxControlToolKit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> above all content tags, but below the page.  Add a script manager to the page, it is in the ajax tools and add it into the maincontent part of the page.  it looks like    
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true">
    </asp:ToolkitScriptManager>
0
 
LVL 12

Accepted Solution

by:
starlite551 earned 860 total points
ID: 36532464
OK I have the perfect solution for you.. All you need to do is follow a few simple steps and you get windows forms Message Box Control or Form class itself accessible in the Web Application. So here are the steps :
1. Go to Solution Explorer Right Click on The Project and Click on Add References.
2. An Add Reference Dialog Box Will Appear.
3. In The .NET Components Section Browse Down Till You See System.Windows.Forms Namespace Reference.Select that by clicking the checkbox next to it and click on OK.
4. After you have done so. Go to the Code Section of your .aspx.cs Page. At the top of the code file in the namespace references using statements list add the following line :
 
using System.Windows.Forms;

Open in new window

5. Now you can call classes that reside within this namespace directly in your Web Application.
6. For Example you can then use the following code in a button click event :
protected void Button1_Click(Object sender,EventArgs e)
{
      MessageBox.Show("You Clicked "+Button1.ClientId.ToString()); 
}

Open in new window

0
 

Author Closing Comment

by:danielolorenz
ID: 36536529
That was great help.  Your solutions were very good.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question