Published: 27 Feb 2009
By: Marissa Levy

Learn how easy it is to embed a Visual WebGui (VWG) form in an ASP.NET application.

Today, we are going to learn how easy it is to embed a Visual WebGui (VWG) form in an ASP.NET application. This capability allows you to quickly develop modules or port WinForms application to Web using VWG and then embed them in your currently working ASP.NET application.

For this I'm going to use a calculator application that I have and embed it in an ASP.NET application.

The Calculator application looks like this:

The first thing that we need to do would be to create an ASP.NET application. Open Visual Studio and add a new Web application project.

Now we are going to add a reference to VWG assemblies and set the DLL’s to copy local.

Add another reference to the VWG application by right clicking on the project and selecting Add Reference->Browse.

Next let’s open the WebForm and register the Gizmox.WebGUI.Forms assembly and add a FormBox control. This control is an ASP.NET control that inherits from System.Web.UI.Control and serves as an iFrame for VWG forms.

I’ve set the height and width of the control and the form that I want to display which is the Form1 from the VWGCalc.dll.

Next we have to add to the Web.Config file the VWG configuration sections. The First is WebGui section declaration in the <configSections>.

After the declaration we can add the WebGUI section. This section holds a few configurations that we will not handle at this point.

But let’s just focus on the applications section. The way Visual WebGui works is the same as WinForms we have to set a start up form like the main form. So I've added Form1 as the start up form and the VWG server will use it as an entry point to the application.

In the httpHandler section we will add a handler for VWG that will route requests with the .WGX extensions to the VWG server and will run the VWG application in the user’s session.

Now we can run our application and see the VWG calculator application in a ASP.NET application. I’ve also added the source of the page.

Next we are going to add some interaction between the VWG application and the ASP.NET site.

Open Default.Aspx page in design mode and add a TextBox and a Button on it like this.

Select the FormBox1 Control and delete the value from the Form property so when the control loads it will show nothing.

Next we are going to create an on button click event by clicking the button. When the button is clicked we will check if we set the FormBox1 Form property to a value and if not we will set it and send an argument to the form.

If the Form property has a value we will clear it and read the same argument to textbox.

Now we can run the application. Enter a number in the text box and press the button to open the calculator.

Once the calculation is finished you can send the result back to the textbox and close the calculator by pressing the button.

To summarize:

We have seen how to embed a Visual WebGui (VWG) application in an ASP.NET application and how to communicate between these applications.

<<  Previous Article Continue reading and see our next or previous articles Next Article >>

About Marissa Levy

Sorry, no bio is available

This author has published 2 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category


jQuery Mobile ListView
In this article, we're going to look at what JQuery Mobile uses to represent lists, and how capable ...
JQuery Mobile Widgets Overview
An overview of widgets in jQuery Mobile.
jQuery Mobile Pages
Brian Mains explains how to create pages with the jQuery Mobile framework.
Code First Approach using Entity Framework 4.1, Inversion of Control, Unity Framework, Repository and Unit of Work Patterns, and MVC3 Razor View
A detailed introduction about the code first approach using Entity Framework 4.1, Inversion of Contr...
Exception Handling and .Net (A practical approach)
Error Handling has always been crucial for an application in a number of ways. It may affect the exe...

You might also be interested in the following related blog posts


Idle Timeouts in RIA Services Authentication read more
Telerik Reporting enters the Silverlight space, adds design-time and performance improvements read more
How do I deploy an application and its prerequisites? (Mary Lee) read more
My ASP.NET MVC stack and why I chosen it read more
Dont Repeat Yourself read more
My History of Visual Studio (Part 2) read more
Debugger Visualizers not working in ASP.NET Medium Trust read more
Accessing Images On Flickr From An ASP.NET Website Using The Flickr.Net Library read more
Auto-Start ASP.NET Applications (VS 2010 and .NET 4.0 Series) read more
Telerik and Imaginet Resources Introduce Free Developer Team Management Tools Built with RadControls for WPF read more
Top
 
 
 

Please login to rate or to leave a comment.

Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.