前台: %@ Control Language="C#" AutoEventWireup="true" CodeFile="ChenLogin.ascx.cs" Inherits="ChenLogin" % asp:TextBox ID="TextBox1" runat="server"/asp:TextBox asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /
前台:
function winpup()
{
if ( document.getElementById('').value == "")
{
alert("不能为空!");
return false;
}
else
{
alert("chen");
return true;
}
}
后台:
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;
using System.Data.SqlClient;
using System.ComponentModel;
public partial class ChenLogin : System.Web.UI.UserControl
{
private string txtname = "";
private string reuri = "";
private string datasource = "";
private string lbltext = "请填写。";
public string Txtname
{
get
{
return this.TextBox1.Text.Trim();
}
}
public string ReURI
{
set
{
reuri = value;
}
}
public string DataSources
{
set
{
datasource = value;
}
}
//[Category("Demo"), Description("Demo from idothink.com")]
public string LblText
{
get
{
return lbltext;
}
set
{
lbltext = value;
this.Invalidate();
}
}
private void Invalidate()
{
this.Label1.Text = lbltext;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button1.Attributes.Add("onclick", "return winpup();");
Button1.Attributes.Add("style", "border:1px solid #F00;color:#F00;");
}
}
//protected override void OnPaint(PaintEventArgs pe)
//{
// // Calling the base class OnPaint
// base.OnPaint(pe);
// // Custom paint code here
// pe.Graphics.DrawString(
// helloValue,
// Font,
// new SolidBrush(ForeColor),
// ClientRectangle, new StringFormat());
//}
protected void Button1_Click(object sender, EventArgs e)
{
//Response.Redirect(reuri);
this.Label1.Text = this.TextBox1.Text;
}
}
如何引用用户控件请查看:
http://blog.csdn.net/ajaxchen_615/archive/2009/05/22/4208247.aspx

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Atom编辑器mac版下载
最流行的的开源编辑器

禅工作室 13.0.1
功能强大的PHP集成开发环境