日期:2014-05-18  浏览次数:20795 次

关于Label控件无法显示内容的问题
我添加了label控件和textbox控件,想实现一个很简单的程序,就是点击Button按钮在label控件上显示textbox里输入的内容,可是label控件里却怎么也不显示。。。。求助大虾啊
C# code



using System;
using System.Data;
using System.Configuration;
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;

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

  }
  protected void Button1_Click(object sender, EventArgs e)
  {
  Label7.Text= TextBox1.Text;
  }
}

[/code]



[code=C#][/code]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>无标题页</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <asp:Label ID="Label1" runat="server" Font-Size="X-Large" ForeColor="Blue" Height="47px"
  Style="z-index: 100; left: 264px; position: absolute; top: 7px" Text="个人信息注册"
  Width="191px"></asp:Label>
  <asp:Label ID="Label2" runat="server" Height="34px" Style="z-index: 101; left: 139px;
  position: absolute; top: 81px" Text="用户名" Width="78px"></asp:Label>
  <asp:Label ID="Label3" runat="server" Height="34px" Style="z-index: 102; left: 139px;
  position: absolute; top: 156px" Text="密码" Width="78px"></asp:Label>
  <asp:Label ID="Label4" runat="server" Height="34px" Style="z-index: 103; left: 139px;
  position: absolute; top: 236px" Text="出生日期" Width="78px"></asp:Label>
  <asp:Label ID="Label5" runat="server" Height="34px" Style="z-index: 104; left: 139px;
  position: absolute; top: 310px" Text="电话号码" Width="78px"></asp:Label>
  <asp:Label ID="Label6" runat="server" Height="34px" Style="z-index: 105; left: 139px;
  position: absolute; top: 382px" Text="e-mail" Width="78px"></asp:Label>
  <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 106; left: 275px; position: absolute;
  top: 90px"></asp:TextBox>
  <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 107; left: 275px; position: absolute;
  top: 165px" TextMode="Password"></asp:TextBox>
  <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 108; left: 275px; position: absolute;
  top: 246px"></asp:TextBox>
  <asp:TextBox ID="TextBox4" runat="server" Style=&quo