选择显示字体大小

c# builder建一个asp.net应用程序


  一般网站建设通常要求开发人员做后台的程序设计,前面有专业的美工做界面设计。虽然有时候开发人员也会做些界面设计,但是通常都无法达到专业的要求。在以前的asp中,由于代码和html页面语言混杂在一起,这就使得网站的建设变得相当的困难。但在asp.net中,这种情况完全改变了。下面就用c# builder建一个简单的asp.net应用程序。

  打开c# builder,选择 file>new>other…菜单项,你将会看到下面的窗口:



  我们选择c# asp projects,你就会看到右边有3种可供选择。我们选择asp.net web application,就可以开始创建我们第一个asp.net应用程序。c# builder会自动在web程序所在地wwwroot目录下面创建一个虚拟目录,在这里叫做webapplication1,你可以根据程序的功能取一个其它的什么名字。这时打开iis,你就会发现产生了一个名为webapplication1的虚拟目录,如果没有自动创建的话,自己用iis创建一个虚拟目录。
你会看到c# builder自动帮你建立了一个名为webform1的web page。这里放上一个label和一个按钮。(注:是html label和html button),如图:



  按f9运行程序,你就会看到你的一个简单的asp.net web页面。是不是很简单?



  以下是我们建的html页面

<%@ page language="c#" debug="true" codebehind="webform1.aspx.cs" autoeventwireup="false" inherits="myaspx.webform1" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

html
<head>
<title></title>
<meta name="generator" content="borland asp.net designer for c# package library 7.1">
</head>

<body ms_positioning="gridlayout">
<form runat="server">
<input style="z-index: 2; left: 246px; width: 75px; position: absolute; top: 150px; height: 24px"
type=button size=25 value=ok><span title
style="z-index: 1; left: 86px; width: 187px; position: absolute; top: 86px; height: 27px">我的asp.net程序!</span><font color=#ccffcc></font>
</form>
</body>
</html

  从第一行中我们可以看出,该页面的后台代码全都在webform1.aspx.cs文件中。我们可以在这个文件中编写程序,生成的代码如下:

using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;

namespace myaspx
{
/// <summary>
/// summary description for webform1.
/// </summary>
public class webform1 : system.web.ui.page
{
private void page_load(object sender, system.eventargs e)
{

}

#region web form designer generated code
override protected void oninit(eventargs e)
{
//
// codegen: this call is required by the asp.net web form designer.
//
initializecomponent();
base.oninit(e);
}

/// <summary>
/// required method for designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void initializecomponent()
{
this.load += new system.eventhandler(this.page_load);
}
}
}

  通过代码后置,开发人员可以直接修改.cs文件。而页面设计人员可以修改html页面,这样就大大简化了网站的建设过程。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons