------------myRegister1.ascx前台代码-----------
复制代码 代码如下:
<script src="/UploadFiles/2021-04-02/Jquery1.7.js"><script type="text/javascript">
function Register() {
if ($('#myRegister1_txtUserName').val() == '') {
$('#spanUserName').text('请输入用户名');
return false;
}
if ($('#myRegister1_txtPwd').val() == '') {
$('#spanPwd').text('请输入密码');
return false;
}
if ($('#myRegister1_txtPwd1').val() == '') {
$('#spanPwd1').text('请输入密码');
return false;
}
if ($('#myRegister1_txtPwd1').val() != $('#myRegister1_txtPwd').val()) {
$('#spanPwd1').text('两次密码要一致');
return false;
}
if ($('#myRegister1_txtEmail').val() == '') {
$('#spanEmail').text('请输入邮箱');
return false;
}
return true;
}
</script>
<table>
<tr>
<td>用户名:</td>
<td>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox></td>
<td><span id="spanUserName"></span></td>
</tr>
<tr>
<td>密码:</td>
<td>
<asp:TextBox ID="txtPwd" runat="server"></asp:TextBox></td>
<td><span id="spanPwd"></span></td>
</tr>
<tr>
<td>确认密码:</td>
<td>
<asp:TextBox ID="txtPwd1" runat="server"></asp:TextBox></td>
<td><span id="spanPwd1"></span></td>
</tr>
<tr>
<td>邮箱:</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
<td><span id="spanEamil"></span></td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnRegister" runat="server" Text="注册"
onclick="btnRegister_Click" OnClientClick="return Register()" /></td>
<td>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
------------myRegister1.ascx后台代码------------
复制代码 代码如下:
public partial class myRegister : System.Web.UI.UserControl
{
public event MyRegeitserDelegate On_MyRegister;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnRegister_Click(object sender, EventArgs e)
{
if (On_MyRegister != null)
{
MyRegister.userName=txtUserName.Text;
MyRegister.pwd=txtPwd.Text;
MyRegister.email = txtEmail.Text;
On_MyRegister();
if (MyRegister.isBool == true)
{
Label1.Text = "注册成功";
}
else
{ Label1.Text = "注册失败"; }
}
}
}
public class MyRegister
{
public static string userName { set; get; }
public static string pwd { set; get; }
public static string email { set; get; }
public static bool isBool { set; get; }
}
public delegate void MyRegeitserDelegate();
---------WebForm事件无参.aspx前台代码--------------
复制代码 代码如下:
<uc1:myRegister ID="myRegister1" runat="server" />
---------WebForm事件无参.aspx后台代码---------------
复制代码 代码如下:
public partial class WebForm事件无参 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.myRegister1.On_MyRegister += new MyRegeitserDelegate(myRegister1_On_MyRegister);
}
void myRegister1_On_MyRegister()
{
MyRegister.isBool = writer(MyRegister.userName, MyRegister.pwd, MyRegister.email);
}
private bool writer(string userName, string pwd, string email)
{
using (Stream stream = File.Open(@"E:\new.txt", FileMode.Append, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(stream))
{
writer.WriteLine("用户名:{0},密码:{1},邮箱:{2}",userName,pwd,email);
}
}
return true;
}
}
复制代码 代码如下:
<script src="/UploadFiles/2021-04-02/Jquery1.7.js"><script type="text/javascript">
function Register() {
if ($('#myRegister1_txtUserName').val() == '') {
$('#spanUserName').text('请输入用户名');
return false;
}
if ($('#myRegister1_txtPwd').val() == '') {
$('#spanPwd').text('请输入密码');
return false;
}
if ($('#myRegister1_txtPwd1').val() == '') {
$('#spanPwd1').text('请输入密码');
return false;
}
if ($('#myRegister1_txtPwd1').val() != $('#myRegister1_txtPwd').val()) {
$('#spanPwd1').text('两次密码要一致');
return false;
}
if ($('#myRegister1_txtEmail').val() == '') {
$('#spanEmail').text('请输入邮箱');
return false;
}
return true;
}
</script>
<table>
<tr>
<td>用户名:</td>
<td>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox></td>
<td><span id="spanUserName"></span></td>
</tr>
<tr>
<td>密码:</td>
<td>
<asp:TextBox ID="txtPwd" runat="server"></asp:TextBox></td>
<td><span id="spanPwd"></span></td>
</tr>
<tr>
<td>确认密码:</td>
<td>
<asp:TextBox ID="txtPwd1" runat="server"></asp:TextBox></td>
<td><span id="spanPwd1"></span></td>
</tr>
<tr>
<td>邮箱:</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
<td><span id="spanEamil"></span></td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnRegister" runat="server" Text="注册"
onclick="btnRegister_Click" OnClientClick="return Register()" /></td>
<td>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
------------myRegister1.ascx后台代码------------
复制代码 代码如下:
public partial class myRegister : System.Web.UI.UserControl
{
public event MyRegeitserDelegate On_MyRegister;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnRegister_Click(object sender, EventArgs e)
{
if (On_MyRegister != null)
{
MyRegister.userName=txtUserName.Text;
MyRegister.pwd=txtPwd.Text;
MyRegister.email = txtEmail.Text;
On_MyRegister();
if (MyRegister.isBool == true)
{
Label1.Text = "注册成功";
}
else
{ Label1.Text = "注册失败"; }
}
}
}
public class MyRegister
{
public static string userName { set; get; }
public static string pwd { set; get; }
public static string email { set; get; }
public static bool isBool { set; get; }
}
public delegate void MyRegeitserDelegate();
---------WebForm事件无参.aspx前台代码--------------
复制代码 代码如下:
<uc1:myRegister ID="myRegister1" runat="server" />
---------WebForm事件无参.aspx后台代码---------------
复制代码 代码如下:
public partial class WebForm事件无参 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.myRegister1.On_MyRegister += new MyRegeitserDelegate(myRegister1_On_MyRegister);
}
void myRegister1_On_MyRegister()
{
MyRegister.isBool = writer(MyRegister.userName, MyRegister.pwd, MyRegister.email);
}
private bool writer(string userName, string pwd, string email)
{
using (Stream stream = File.Open(@"E:\new.txt", FileMode.Append, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(stream))
{
writer.WriteLine("用户名:{0},密码:{1},邮箱:{2}",userName,pwd,email);
}
}
return true;
}
}
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月25日
2024年11月25日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]