ASP.NET提供了一种称为Web Forms的技术,这使得开发人员可以在ASP.NET网页中使用所见即所得(WYSIWYG)的方式来构建网页界面。下面是一个包含代码示例的解决方法:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %>
ASP.NET WYSIWYG Web Page
using System;
using System.Web.UI;
namespace WebApplication1
{
public partial class Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = txtName.Text;
lblName.Text = "Hello, " + name + "!";
}
}
}