三度网教程:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

在ASP+ 中我们如何运用 Class 而不是组件

时间:2024-1-29作者:未知来源:三度网教程人气:


/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
*/
asp+ 中我们有办法使用 预编译(div-release)的代码 而不是 已经编译好的 二进制代码(build-in) 的组件
下面我们来看看一个例子

你可能会用到类似下面的代码:
<%@ Assembly src="test.cs" %> // Compile C# class
<%@ Assembly src="test.vb" %> // Compile VB class
在 代码的最上方 我们使用这样的 代码告诉编译器 把 文件中包含的 Class 编译到asp+ 的页面中

test.cs:

public class MyClass {

public string SaySomething() {
return "豆腐制作 都是精品";
}
}
test.vb:
public class test
readonly Property SaySomething() as string
get
SaySomething="豆腐制作 都是精品"
end get
end Property
end class

test.aspx:

<%@ Assembly Src="test.vb" %>

<html>
<script language="VB" runat=server>

Sub Page_Load(Sender as Object, E as EventArgs)

Dim Temp as New test
lblMsg.Text = temp.SaySomething()

End Sub

</script>

<body>
<asp:label id="lblMsg" runat=server/>
</body>
</html>


作者:豆腐()


关键词:  在ASP+  中我们如何运用  Class  而不是组件





Copyright © 2012-2018 三度网教程(http://www.3du8.cn) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版