日期:2014-05-17  浏览次数:20437 次

asp.net的代码不是太熟悉,怎么没有cs文件,参照以下代码能否给个显示helloword的例子
以下是从网奇里找到的代码,本来想好好的学习他们的代码,可本人太菜了,看不懂
怎么没有codefile标签和对应的cs文件,参照以下代码能否给个显示helloword的例子
<%@Page Language="C#" Inherits="IWMS.Pages.TempTrans" EnableSessionState="false" EnableViewState="false" %>
<%@OutputCache Duration="180" Location="None" VaryByParam="none" VaryByCustom="convBig5"%>
<%Trans(TemplateType.Index);%>
我发现他们整套系统的aspx文件都没有codefile标签和aspx文件对应的cs文件,咋回事?

------解决方案--------------------
被编译了呗,人家不想让你看代码,只让你用。Windows安装盘中有Windows源代码么?
------解决方案--------------------
HTML code
<%@ Page Language="C#" AutoEventWireup="true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%Response.Write("hellow word"); %><br />

    </div>
    </form>
</body>
</html>

------解决方案--------------------
Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head" runat="server">
<title>Say Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
<form id="form" runat="server">

<asp:Label ID="lb1" runat="server" Text=""></asp:Label>

</form>
</body>
</html>

.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lb1.Text="Hello! 这是一个Hello的例子。";
}

  
}



------解决方案--------------------
Inherits="IWMS.Pages.TempTrans"

被编译了
------解决方案--------------------
源:

 <asp:Button ID="Button2" runat="server" Text="修改我的资料" OnClick="Button2_Click" />

CS:

protected void Button2_Click(object sender, EventArgs e)
{
Response.Write("hello world!");
}
------解决方案--------------------
探讨

另外编译后 Inherits="Default"系统将为它变成什么样的