在ASP.net中包含代码 [英] Include code in ASP.net

查看:126
本文介绍了在ASP.net中包含代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.net文件,我试图包括动态代码,这在经典ASP中很容易.

I've got an ASP.net file, and I'm trying to include dynamic code which was easy in classic ASP.

这是我到目前为止尝试过的:

Here is what I have tried so far:

<%@ Register TagPrefix="TagPre" TagName="header" Src="alg/classes.aspx"%> 

<!--#include file="alg/classes.aspx"-->

但是这些似乎都不起作用.classes.aspx的内容是:

But neither of these seem to work. The content of classes.aspx is:

<script runat="server">   
' Square class
Public Class square

    Public sqRows As Integer        'Numbers of rows this square has
    Public sqCols As Integer        'Number of columns this square has
    Public sqArray(,) As Integer    'The square array

    ' Initialise square array to match size of canvas
    Public Sub initSqArray(ByVal canvCols, ByVal canvRows)
        ReDim sqArray(canvCols, canvRows)
        sqRows = canvRows
        sqCols = canvCols
    End Sub

End Class

感谢您的帮助!

推荐答案

您遇到的具体问题或错误是什么?当您使用.aspx时,您是否已经尝试过将VB代码放在代码隐藏表"中并从那里拉出来?

What is the concrete problem or error you got? When you are using .aspx, did you already try to put the VB-Code in the Code-Behind-Sheet and pull it from there?

这篇关于在ASP.net中包含代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆