制作内幕 游戏 网站 图标 | 理论 图标在线制作 | 看图软件 访谈活动 | 教程 技术 万年历
当前位置:首页>CG 教 程>网站开发>ASP.NET>

相关文章

推荐文章

     

热门文章

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

作者:CG谷 出处: 发布时间:2006-07-11 字体: [ ]

/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
*/
asp+ 中我们有办法使用 预编译(pre-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>


作者:豆腐()


↑返回顶部   打印本页   关闭窗口↓  
收藏本文到:天极网摘 新浪VIVI 和讯网摘 博彩中心 365Key网摘 poco网摘 狐摘
亿友响享Yeeyoo igooi-it网摘 5seek网摘 I2Key 我摘网摘 天下图摘 YouNote 百特门
用户名: 新注册) 密码: 匿名评论 [所有评论]
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
设计服务 | 广告投放 | 友情链接 | 关于本站 | 联系我们 | 版权声明 | 设为首页 | 加入收藏