찾다
php教程php手册c#用户控件

c#用户控件

Jun 06, 2016 pm 08:01 PM
controllanguagephp제어사용자

前台: %@ 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

 

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

PhpStorm 맥 버전

PhpStorm 맥 버전

최신(2018.2.1) 전문 PHP 통합 개발 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경