载入方式:
private void Page_Load(object sender, System.EventArgs e)
{
FormControl.Controls.Add(LoadControl("USER/REG.ascx"));
}
private void Page_Load(object sender, System.EventArgs e)
{
FormControl.Controls.Add(LoadControl("USER/REG.ascx"));
}
2.看一下有没有 this.btnOk.Click += btnOk.Click(.....)一句
3.是否页面中有客户端验证控件,而验证控件的 ErrMessage 属性的值为空.FormControl是指什么控件?
System.Web.UI.Control objContainer=Page.ParseControl("<form id=SocutForm runat=server "+strTarget+"></form>");
Controls.Add (objContainer);//加载到页面
//定义Form控件
System.Web.UI.Control FormControl=Page.FindControl("SocutForm");2、您提出的其它问题均正常
ms-help://MS.NETFrameworkSDKv1.1.CHS/cpref/html/frlrfSystemWebUITemplateControlClassLoadControlTopic.htm
.net framework 1.1
void Button_Click(Object sender,EventArgs e)
{
Page.Response.Write("Button is clicked at " + DateTime.Now);
}
</script>
<asp:Button runat="server" Text="Click Me" OnClick="Button_Click" />2. testreg.aspx<script language="C#" runat="server">
void Page_Load(object sender, System.EventArgs e)
{Control objContainer=Page.ParseControl("<form id=SocutForm runat=server></form>");
Controls.Add (objContainer);
Control FormControl=Page.FindControl("SocutForm");
FormControl.Controls.Add(LoadControl("REG.ascx"));
}</script>
<TABLE class="FontContent" id="TUserReg" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<TR>
<TD height="25">
<P><FONT face="宋体"></FONT><FONT face="宋体"></FONT><BR>
抱歉,本站暂停注册!<BR>
<BR>
</P>
</TD>
</TR>
</TABLE>
<table class="FontContent" id="TRead" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<tr>
<td height="25">
<p><FONT face="宋体"></FONT><br>
互相尊重,对自己的言论和行为负责。
<br>
<br>
</p>
</td>
</tr>
<tr>
<td height="25">
<div align="center"><asp:imagebutton id="ImageButton1" runat="server" ImageUrl="../Images/User/regist_agree.gif"></asp:imagebutton>
<A href="../Server/?ID=Index"><IMG height="34" src="Images/User/regist_unagree.gif" width="52" border="0"></A></div>
</td>
</tr>
</table>
<table class="FontContent" id="TCheck" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<tr>
<td height="50">
<p><FONT face="宋体"><BR>
<asp:label id="CheckInfo" runat="server">信息提示:用户名最多6个中文或12个英文</asp:label><BR>
输入用户名:
<asp:textbox id="CheckName" runat="server" CssClass="inputBig"></asp:textbox>
<asp:linkbutton id="LinkButton1" runat="server">检测</asp:linkbutton><asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" ControlToValidate="CheckName" ErrorMessage="总得先起个名吧?"></asp:requiredfieldvalidator><BR>
<BR>
</FONT>
</p>
</td>
</tr>
</table>
<table class="FontContent" id="TMust" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<tr>
<td height="50">用户姓名:
<asp:label id="UserName" runat="server">Label</asp:label>
<table class="set" id="Table2" cellSpacing="0" cellPadding="0" width="300" border="0">
<tr>
<td width="60">个人形象:</td>
<td width="219"><%=myFace.GetFace("Images/Face/",64,"Set","Socut",0,"")%>
</td>
</tr>
</table>
用户密码:
<asp:textbox id="PassKey" runat="server" CssClass="inputBig" TextMode="Password"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ControlToValidate="PassKey" ErrorMessage="没密码,能安全吗?"></asp:requiredfieldvalidator><BR>
重复密码:
<asp:textbox id="RePassKey" runat="server" CssClass="inputBig" TextMode="Password"></asp:textbox><asp:comparevalidator id="CompareValidator1" runat="server" ControlToValidate="PassKey" ErrorMessage="两次密码不一致!"
ControlToCompare="RePassKey"></asp:comparevalidator><BR>
联系邮箱:
<asp:textbox id="Email" runat="server" CssClass="inputTitle">@</asp:textbox><asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" ControlToValidate="Email" ErrorMessage="好象格式不太对哦?"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:regularexpressionvalidator><BR>
密码提示:
<asp:textbox id="Question" runat="server"></asp:textbox><BR>
密码答案:
<asp:textbox id="Answer" runat="server"></asp:textbox><BR>
ubb 签名:
<asp:textbox id="UnderWrite" runat="server" CssClass="inputBig" TextMode="MultiLine" Height="60px"
Width="264px"></asp:textbox><BR>
验证条码:
<asp:textbox id="GetCode" runat="server" CssClass="inputTitle" Width="56px"></asp:textbox><asp:image id="Image2" runat="server" ImageUrl="../Admin/GetCode.aspx"></asp:image><BR>
<BR>
<asp:linkbutton id="LinkButton2" runat="server">提交信息</asp:linkbutton><asp:label id="LSend" runat="server"></asp:label>
<asp:ImageButton id="ImageButton2" runat="server"></asp:ImageButton><BR>
<BR>
<BR>
</FONT></td>
</tr>
</table>
<table class="FontContent" id="TDetail" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<tr>
<td height="50">
<p><FONT face="宋体">性别:
<asp:dropdownlist id="Sex" runat="server">
<asp:ListItem Value="3">保密</asp:ListItem>
<asp:ListItem Value="2">美女</asp:ListItem>
<asp:ListItem Value="1">帅哥</asp:ListItem>
</asp:dropdownlist><BR>
生日:
<asp:textbox id="Birthday" runat="server" CssClass="inputBig"></asp:textbox><BR>
城市:
<asp:textbox id="City" runat="server" CssClass="inputBig"></asp:textbox><BR>
QQ号:
<asp:textbox id="QQ" runat="server" CssClass="inputBig"></asp:textbox><BR>
ICQ:
<asp:textbox id="ICQ" runat="server" CssClass="inputBig"></asp:textbox><BR>
主页:
<asp:textbox id="HomePage" runat="server" CssClass="inputBig"></asp:textbox><BR>
</FONT>
</p>
</td>
</tr>
</table>
<table class="FontContent" id="TOK" cellSpacing="0" cellPadding="0" width="80%" align="center"
border="0" runat="server">
<tr>
<td height="50">
<p><FONT face="宋体"><BR>
恭喜您!<BR>
您已成功注册为本站会员,请登陆!<BR>
</FONT>
</p>
</td>
</tr>
</table>
namespace Socut_Ver3.xx.Skin.Sys_UC
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls; using Socut_Ver3.xx.Admin;
using System.Data .OleDb ;
using Socut; /// <summary>
/// Reg 的摘要说明。
/// </summary>
public class Reg : SocutPage
{
public CFace myFace=new CFace ();
protected System.Web.UI.HtmlControls.HtmlTable TRead;//表格
protected System.Web.UI.HtmlControls.HtmlTable TCheck;//表格
protected System.Web.UI.HtmlControls.HtmlTable TMust;//表格
protected System.Web.UI.HtmlControls.HtmlTable TDetail;//表格
protected System.Web.UI.HtmlControls.HtmlTable TOK;//表格
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox CheckName;
protected System.Web.UI.WebControls.Button Button2;
public CSocut mySocut=new CSocut ();
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.Label UserName;
protected System.Web.UI.WebControls.TextBox Email;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.Label CheckInfo;
protected System.Web.UI.WebControls.TextBox GetCode;
protected System.Web.UI.WebControls.TextBox PassKey;
protected System.Web.UI.WebControls.TextBox RePassKey;
protected System.Web.UI.WebControls.DropDownList Sex;
protected System.Web.UI.WebControls.TextBox Birthday;
protected System.Web.UI.WebControls.TextBox City;
protected System.Web.UI.WebControls.TextBox QQ;
protected System.Web.UI.WebControls.TextBox ICQ;
protected System.Web.UI.WebControls.TextBox UnderWrite;
protected System.Web.UI.WebControls.TextBox HomePage;
protected System.Web.UI.HtmlControls.HtmlTable TUserReg;
protected System.Web.UI.WebControls.TextBox Answer;
protected System.Web.UI.WebControls.TextBox Question;
protected System.Web.UI.WebControls.Image Image2;
protected System.Web.UI.WebControls.Label LSend;
public CReader dr; private void Page_Load(object sender, System.EventArgs e)
{ //====================================================
if(!Page.IsPostBack)//
{
TRead.Visible =true;//SOCUT.COM提示:只显示协议阅读
TCheck.Visible =false;
TMust.Visible =false;
TDetail.Visible =false;
TOK.Visible =false;
//****************** 是否开通用户注册 ******************
if(mySocut.GetInfo("UserReg")=="0")
TRead.Visible =false;
else//1=正常注册
TUserReg.Visible=false;
}
} private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
TRead.Visible =false;
TCheck.Visible =true;
}
//*************************************
//***
private void Button1_Click(object sender, System.EventArgs e)// {
//********************* 用户名长度检测 }
private void Button2_Click(object sender, System.EventArgs e)//提交信息按钮
{
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
1。没有加载事件响应的handler语句。
2。用户控件没有在html页首注册或者没有放到服务端运行的form中
3。事件响应程序写错了或者被减一次重载了
4。页面回送或开发环境出错等其他因素。