asp.net 4.5 ejercicio ~ test4-6

webform1.aspx 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test4_6.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        付款地址:<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="45px" Width="199px"></asp:TextBox>
        <br />
        发货地址:<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Height="45px" Width="199px"></asp:TextBox>
        <br /><br />
        <asp:CheckBox ID="CheckBox1" runat="server" Text="发货地址与付款地址相同" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />
    </div>
    </form>
</body>
</html>

webform1.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace test4_6
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (CheckBox1.Checked)
            {
                TextBox2.Text = TextBox1.Text;
            }
            else
            {
                TextBox2.Text = "";
            }
        }
    }
}

 

Supongo que te gusta

Origin blog.csdn.net/modern358/article/details/114256400
Recomendado
Clasificación