在线等!如何在index.aspx中调用我写的这个AllUserInfo.cs文件请帮忙我是新手!!!

KimSoft
博客专家认证
2003-04-12 02:41:51
类文件的扩展名是什么!

********************以下是index.aspx文件*************
<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" Inherits="KGGS_Pro.Login" %>
<HTML>
<HEAD></head>
<body></body>
</html>
</html>





********************以下是AllUserInfo.cs文件*************




using System;

namespace KGGS_Pro
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class AllUserInfo
{
string strUserName,strUserPwd,strUserTel,strUserAddr;
public AllUserInfo()
{
strUserName = "";
strUserPwd = "";
strUserTel = "123456";
strUserAddr = "";
}
string getUserName()
{
return this.strUserName;
}
string getUserPwd()
{
return this.strUserPwd;
}
string getUserTel()
{
return this.strUserTel;
}
string getUserAddr()
{
return this.strUserAddr;
}
}
}



*****************************以下是index.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 KGGS_Pro
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class Login : 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:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}
...全文
40 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
DavidBone 2003-04-18
  • 打赏
  • 举报
回复
up
51946486 2003-04-12
  • 打赏
  • 举报
回复
你参考index.aspx.cs中的那些函数结构就可以了。基本一样的。
KimSoft 2003-04-12
  • 打赏
  • 举报
回复
谢谢(老鼠米)和XiaoHui0930正确了!!马上给分!!小弟还有问题就是我能不能在index.aspx中用呢?我想在index.aspx中定义一个函数用怎么作?我可以加分给你们的,请帮小弟一把!!!
XiaoHui0930 2003-04-12
  • 打赏
  • 举报
回复
在index.aspx.cs中前面加using KGGS_Pro;

e.g:
using System;
using KGGS_Pro;
51946486 2003-04-12
  • 打赏
  • 举报
回复
AllUserInfo myuser=new AllUserInfo();
myuser.属性名
muuser.方法名(参数)
KimSoft 2003-04-12
  • 打赏
  • 举报
回复
<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" Inherits="KGGS_Pro.Login" %>
<%@ Import namespace="KGGS_Pro" %>
<HTML>
<HEAD></head>
<body></body>
</html>
</html>
是这样加进去是吗?那么我想用AllUserInfo中的方法如何用?是在index.aspx中引用还是要在index.aspx.cs中用里面的方法!!!请指教!!!
KimSoft 2003-04-12
  • 打赏
  • 举报
回复
AllUserInfo中的方法我如何引用!!!我不会引用啊请指教!!
comy 2003-04-12
  • 打赏
  • 举报
回复
<%@ Register Namespace="KGGS_Pro"%>
51946486 2003-04-12
  • 打赏
  • 举报
回复
AllUserInfo myuser=new AllUserInfo();
直接声明调用即可.不过你的
AllUserInfo类中的属性最好设为public .不然不能访问的。
comy 2003-04-12
  • 打赏
  • 举报
回复
<%@ Import namespace="KGGS_Pro" %>

62,072

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧