Build your first Wisej.NET app
Build your first Wisej.NET application in Visual Studio: create a project, design a window, handle a button click in C#, and run your app in a browser.
Transcript
Module one. Your first Wisej.NET application. We'll build a small screen that asks for a name and displays a greeting. This introduces the basic workflow: design the interface, handle an event, and test the result in a browser.
Start in Visual Studio and choose Create a new project. Wisej.NET uses the familiar project workflow, with templates that provide the initial application files. The interface will run in the browser, while our event code runs on the server.
Search for Wisej.NET. This walkthrough uses the Wisej.NET 4 Web Application template with C#. Select that template and continue. If it is missing from your own installation, check that the Wisej.NET extension and project templates are installed before proceeding.
Choose a project name and a location, then click Create. Visual Studio generates the project and its starting window. Look at Solution Explorer: this is where you'll find the application files and return to the window as you build the screen.
Build the project before opening the designer. The build compiles the application so the designer can load its types. Watch the Output window and wait for Build succeeded. If the build fails, resolve the errors before continuing with the layout.
In Solution Explorer, double-click Window1 to open its design view. This is the surface where we arrange the controls. The designer records their layout in Window1.Designer.cs. Keep that generated file under the designer's control; write the screen's behavior in Window1.cs.
Drag the controls from the Toolbox onto the window. A label asks for the user's name, a text box accepts the answer, and a button will run the greeting. Add a second label for the result. Each control now has a clear role in the interaction.
Set each control's Name and Text in the Properties window. Name is the identifier used by your code; Text is what the user sees. Use txtName for the input, btnSayHello for the button, and lblStatus for the result. The heading label is lblTitle.
Double-click the button to create its Click handler. Read txtName.Text and trim the spaces. If the result is empty, set lblStatus.Text to a message asking for a name, then return. Otherwise, put the greeting in the label. Validation happens before the successful response.
Press Start to run the application locally. When the browser opens, enter a name and click Say Hello. The Click handler runs and the result label displays the greeting. You have connected a visually designed screen to C# code and seen the response in the browser.