ASP.NET - WF示例

ASP.NET - WF示例 首页 / ASP.Net MVC入门教程 / ASP.NET - WF示例

在这里,无涯教程使用在上一个主题中创建的项目。要在现有项目中添加新的Web表单,请首先选择项目,然后右键单击并添加新项。

ASP New web form 1

选择左角的Web表单选项,然后选择Web表单并单击添加按钮。

无涯教程网

ASP New web form 2

现在单击Add按钮,此表单将添加到项目中。

添加表单后,可以看到这现在位于项目中,如下图所示。

链接:https://www.learnfk.comhttps://www.learnfk.com/asp.net_mvc/asp-net-web-form-example.html

来源:LearnFk无涯教程网

ASP New web form 3

双击此表单,将显示一些自动生成的代码,如下所示:

ASP New web form 4

//user-form.aspx

<%@ Page Language="C#"  AutoEventWireup="true" CodeBehind="user-form.aspx.cs"
Inherits="asp.netexample.user_form" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

如果在浏览器上运行此文件,它不会显示任何输出。那么,通过这个表单打印一些消息。

修改后的代码如下。

//user-form.aspx

<%@  Page Language="C#" AutoEventWireup="true" CodeBehind="user-form.aspx.cs"
Inherits="asp.netexample.user_form" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Welcome to the Web Forms!</h2>
</div>
</form>
</body>
</html>

在浏览器上运行后,它会产生以下输出。

ASP New web form 5

除了这条消息,还可以做很多事情,还可以向此页面添加控件。无涯教程将在下一章中向窗体添加控件。

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

Go语言核心36讲 -〔郝林〕

TensorFlow快速入门与实战 -〔彭靖田〕

趣谈Linux操作系统 -〔刘超〕

性能工程高手课 -〔庄振运〕

SRE实战手册 -〔赵成〕

Go 语言项目开发实战 -〔孔令飞〕

云计算的必修小课 -〔吕蕴偲〕

B端体验设计入门课 -〔林远宏(汤圆)〕

程序员职业规划手册 -〔雪梅〕

好记忆不如烂笔头。留下您的足迹吧 :)