vs2005中 Placeholder控件问题

ahao266 2006-04-03 12:15:44
用Placeholer控件动态创建Login控件
<%@ page language="C#" %>

<script runat="server">
// This custom Login control checks the user name
// entered by the user is a valid e-mail address
class CustomLogin : Login
{
bool IsValidEmail(string strIn)
{
// Return true if strIn is in valid e-mail format.
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
}

override protected void OnLoggingIn(System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (!IsValidEmail(UserName))
{
InstructionText = "You must enter a valid e-mail address.";
e.Cancel = true;
}
else
{
InstructionText = String.Empty;
}
}
}

// Add the custom login control to the page.
void Page_Load(object sender, EventArgs e)
{
CustomLogin loginControl = new CustomLogin();
loginControl.ID = "loginControl";
Placeholder1.Controls.Add(loginControl);
}

</script>
<html>
<body>
<form id="Form1" runat="server">
<asp:placeholder id="Placeholder1" runat="server"></asp:placeholder>
</form>
</body>
</html>


override protected void OnLoggingIn重写这一方法中,如何通过重写实现一些别的功能,比如说在页面上加入Label1,要实现按下登录就进行Label1.text="hello",这个在这个方法里面不能写,请问在哪写呀,我想应该是保护的问题,但是不知如何解决???
...全文
159 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
arcane_1818 2006-04-03
  • 打赏
  • 举报
回复
UP

62,046

社区成员

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

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

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

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