你好.你的问题我写了一点代码给你.希望对你的理解有帮助.有问题可以发信息给我.代码如下:
----Site.master----
<form id="form1" runat="server">
<div>
<h1>Master Page Scope</h1>
<asp:TextBox ID="tbFromMaster"
runat="server"
EnableViewState="false">
</asp:TextBox>
<button type="button" onclick="GetResult()">GO</button>
</div>
<hr />
<div>
<h1>Content Page Scope</h1>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server"
EnableViewState="false">
</asp:ContentPlaceHolder>
</div>
</form>
----Default.aspx----
<asp:Content ID="Content1"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<span id="txtLabel"></span>
</asp:Content>
----Default.aspx.cs----
using System;
using System.Text;
public partial class _Default : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
StringBuilder sb = new StringBuilder();
sb.Append("function GetResult(){\n");
sb.Append(String.Format("document.getElementById('txtLabel').innerHTML = document.getElementById('{0}').value;", this.Master.FindControl("tbFromMaster").ClientID));
sb.Append("}\n");
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "demo", sb.ToString(), true);
}
}