.net关于如何给用户控件传值问题解决
网页前台:中间插入用户控件,需注册自定义控件
...
<uc1:test ID="test1" runat="server" ShowTitle="您想要传值的值"/>
...
用户控件前台:<asp:Label ID="lblShowTitile" runat="server" Text="关键词:"></asp:Label>
<asp:TextBox ID="txtKeywords" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="搜索" />
public partial class UserControl_test : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string ShowTitle
{
get
{
return lblShowTitile.Text;
}
set
{
lblShowTitile.Text = value;
}
}
}
经验在于积累----武二郎