想请个热心的帅哥或美女帮我解决下,,感激涕零
如果可以的话请先帮我看看这个简短的教程,
http://book.csdn.net/bookfiles/259/10025911578.shtml
[此贴子已经被作者于2007-4-27 0:24:07编辑过]
[此贴子已经被作者于2007-4-27 0:24:07编辑过]
TestUc.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestUC.aspx.cs" Inherits="Example.TestUC" %>
<%@ Register Tagprefix="uclogin" TagName="MyUsercontrol" Src="MyUsercontrol.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<uclogin MyUsercontrol id="MyUClogin" runat="server" />
<asp:Button ID="GetNamePwd" runat="server" Text="获取用户名称和密码" />
<asp:TextBox ID="tUserName" ReadOnly="true" runat="server" Width="200" Enabled="false" />
<asp:TextBox ID="tUserPwd" ReadOnly="true" runat="server" Width="200" Enabled ="false" />
</form>
</body>
</html>
MyUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="false" CodeFile="MyUserControl.ascx.cs" Inherits="Example.MyUserControl" %>
<table>
<tr>
<td colspan="2">用户登陆控件</td>
</tr>
<tr>
<td width="150" align="right">用户名字</td>
<td width=200> <asp:TextBox ID="tUserName" runat="server" Width="135px" /></td>
</tr>
<tr>
<td width=150 align="right">用户密码</td>
<td width=200> <asp:TextBox ID="tPassword" runat="server" TextMode="password" Width="135px" /></td>
</tr>
<tr>
<td align="right" > <asp:Button ID="UserLoginBtn" runat="server" Text="确定" OnClick="UserLoginBtn_Click" /></td>
<td align="left" > <asp:Button ID="CancelBtn" runat="server" Text="取消" OnClick="CancelBtn_Click" /></td>
</tr>
</table>
MyUserControl.ascx.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;
namespace MyUsercontrol
{
public partial class MyUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public String UserName
{
get { return (tUserName.Text); }
set { tUserName.Text = value; }
}
public String Password
{
get { return (tPassword.Text); }
set { tPassword.Text = value; }
}
private void UserLoginBtn_Click(object serder, System.EventArgs e)
{
}
private void CancelBtn_Click(object serder, System.EventArgs e)
{
}
}
}
编译器错误信息: ASPNET: 请确保此代码文件中定义的类与“inherits”属性匹配,并且该类扩展的基类(例如 Page 或 UserControl)是正确的。
行 13: public partial class MyUserControl : System.Web.UI.UserControl