Rick Strahl's Weblog
Rick Strahl's FoxPro and Web Connection Weblog
White Papers | Products | Message Board | News |

Web Connection 5.0 and Visual Studio 5.0 FAQ


2 comments
April 19, 2006 •

Here are a few common questions that have been cropping up on the message board over the last couple of months in relation to Web Connection 5.0 and Visual Studio.

 

 

Question: Do I need to use Visual Studio with Web Connection 5.0

 

Answer: No definitely not. Web Connection 5.0 like its predecessors has no dependencies on anything related to .NET so you can build your applications without VS. However, the new Web Connection Web Control Framework (WCF) can utilize Visual Studio 2005 to provide visual design, editing and control editors for creating script pages for use with the WCF. But it's important to understand that VS is used only for design and no .NET code is used at runtime. Web Connection merely highjacks Visual Studio to provide you with WYSIWYG editing, Intellisense on controls and the rich editors that VS.NET provides. But you can build the WCF script pages using any text editor including the Visual FoxPro editor if you don't want to use Visual Studio.

 

That said, if you are building WCF based application, you will want to use VS2005 because it makes developing these page much, much easier. VS.NET provides WYSIWYG editing, strong intellisense for HTML and your controls and designers that let you set properties interactively all of which makes you much more productive when laying out content.

 

Question: Do I need the .NET runtime on my server for my Web Connection WCF application

 

Answer: No. Web Connection doesn't use .NET at runtime at all. The WCF is implemented purely in FoxPro code so the .NET runtime is not required. You can run Web Connection on an old pre-.NET server and even run your WCF application on Apache (for Windows).

 

Question: Can I run the Web Control Framework Pages in Visual Studio 2003

 

Answer:  Yes and no. <s> The Web Control Framework was designed with Visual Studio 2005 in mind and the controls that ship with Web Connection work only in Visual Studio .NET 2005/Visual Web Developer 2005. However, Web Connection can work with some of the stock ASP.NET controls like TextBox, Checkbox, Radio, Label etc. so you can use VS 2003 with native controls to design layouts. However, VS 2003 can't display custom extension pages as Web Forms anyway so you'd be limited to mapping the ASPX extension to your Web Connection application.

 

Overall I wouldn't recommend using Visual Studio 2003 for developing Web Connection applications.

 

Question: Can I use all standard ASP.NET Controls with Web Connection?

Answer: No. Remember Web Connection implement an ASP.NET like engine completely in FoxPro code, in the process taking advantage of some of the data centric and dynamic language features of FoxPro, providing some advantages and features that ASP.NET actually doesn't possess – like for example, dynamic two databinding, dynamic expression evaluation for most controls, binding to cursors etc.

 

Web Connection supports any ASP.NET control that can be mapped to a Web Connection control so asp:TextBox maps to wwWebTextBox, asp:Label to wwWebLabel etc. It works as long as the Web Connection control matches the properties of the ASP.NET control.

 

For best results and making sure that you only see properties that are available on the Web Connection controls you should use the Web Connection controls (or your custom controls) only.

 

Question: What limitations are there in Visual Web Developer

 

Answer: Visual Web Develop is Microsofts free but stripped down version of Visual Studio with focus on ASP.NET Web development. It actually works quite well for building WCF applications with Web Connection. But there are a few limitations of VWD that you should be aware of:

 

  • It doesn't support Add-ins so the Web Connection Source View Add-in on the tools menu isn't available
  • You can't add another project to your Web Solution, so you can't explicitly add the Web Connection Web Controls Project to the solution

 

Question: How do I configure Visual Studio for operation with Web Connection

 

Answer: Most of the configuration is done automatically when you install Web Connection and when you create new projects. There are a few features that need to be configured in Visual Studio both globally and then when a new project is created. Specifically:

 

  • Add the Web Connection Web Controls to the Toolbar (manual one time process)
  • Configure the Editor to recognize your script pages as Web Forms (automatic when project created)

 

The former is a one time process and must be performed manually. You basically need to add a tab to the toolbox and add the controls from the Web Connection Control assembly onto the toolbar. The latter is required so that Visual Studio can recognize your script page extension (WCSX or custom extension for your particular process) as a Web Form. This requires configuring the editor and setting up a build provider. This process is automated as part of the new project Wizard which creates the appropriate mappings in the registry and in the web.config file.

 

These steps are outlined in detail in the documentation in this topic.

 

http://www.west-wind.com/webconnection/docs/index.htm?page=_1O101AVI1.htm

 

and also mentioned in detail in the Walk Through:

 

http://www.west-wind.com/webconnection/docs/index.htm?page=_1LX0R1R7U.htm

 

If you're starting to use Visual Studio I highly recommend you step through these topics once and configure your environment. It'll only take a few minutes but getting everything working right up front makes life a lot easier while you're working later on.

 

 

Question: Can I create my own Web Connection WebControls

 

Answer:  Yes definitely. Web Connection is designed to be extended and you can create your own custom controls that can be used from the designers. The first step is to create a new control that derives from wwWebControl or one of the existing Web controls shipped with Web Connection. Web Controls are FoxPro classes that implement the control behavior. The key feature of each control is the Render() functionality which ultimately needs to draw the control as HTML output. Render() is required. Additional methods may need to be implemented to handle retrieving control state, or for adding script code to the page. You can override existing functionality to make this happen. The best way to see how this is done is to review how some of the Web Connection controls are implemented. Some controls are very simple – they only implement a Render() method, others like say the wwWebDataGrid are fairly sophisticated and hook a number of the framework events to properly handle the processing of the control.

 

Once you've built the control you can use it in your script pages simply by refencing the control by name (ww:wwWebMyControl). Any custom properties you created are exposed as attributes which when set cause the properties to be assigned. Once you built the control the only requirement is that you make sure that Web Connection can find the control via SET PROCEDURE or what ever is required to make the control available. Make sure you implement any controls in their own PRG file – don't create them in the existing source files provided by Web Connection.

 

Question: The above works, but I don't see the control in Visual Studio Designer. Why not?

 

Answer: The FoxPro code implements the actual control and this is the only thing Web Connection needs to execute the control. However, Visual Studio knows nothing about your control at this point. In order for VS to be able to see the control it requires a .NET control. So in order to build a control that is visible in the designer you have to create a new .NET project and implement a Web control. Because these controls are used only in the designer, implementing these controls consists of two things:

 

  • Creating the Property Interface
  • Providing basic rendering for the designer

 

The .NET control doesn't need to be complete it only needs to match the property interface of your custom properties so you can set properties in the property editor. To so you can set a few attributes that provide help text and default values and so on. The control also needs to render in the designer so unless you are overriding an existing ASP.NET control, you'll have to write a little code to show the control in the designer in its Render() method. Any code you write in Render() shows up in the designer.

 

The process is fairly simple, but it does require you to write .NET code to implement the class. As with the FoxPro classes the best place to see how this works is to open the WebConnectionWebControls project and look at the existing controls and how they are implemented. As with the Fox classes make sure you implement any new controls in a separate project so that updates don't blow away your changes. Once you've created your project and compiled it into an assembly you need to add it to the toolbar just like the Web Connection controls.

Posted in:

Feedback for this Weblog Entry


Re: Web Connection 5.0 and Visual Studio 5.0 FAQ



Harvey Mushman
February 24, 2007

How much of this posting applies to Visual Web Developer 2005?

Visual Studio Web Developer 2005



sam
April 09, 2007

hey could u help me to know does Visual Studio Web Developer 2005 suports the Tab Control ? if so let me know please

 
© Rick Strahl, West Wind Technologies, 2003 - 2024