控件前台 < input type = " text " runat = " server " id = " tbValue " /> 控件后台 public partial class WebUserControl1 : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { string script = string.Format(@" var {0}={{}}; {0}.getValue=function() {{ return document.getElementById('{1}').value; }}", this.ClientID, this.tbValue.ClientID); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "reg", script, true); } } 引用页面 < div > < uc1:WebUserControl1 id = " WebUserControl1_1 " runat = " server " > </ uc1:WebUserControl1 ></ div > < input type = " button " onclick = " show() " value = " click " /> </ form > < script language = " javascript " > function show() { alert(<%=WebUserControl1_1.ClientID%>.getValue()); } </ script > 转载于:https://www.cnblogs.com/lishenglyx/archive/2009/01/04/1368430.html