【发布时间】:2010-03-31 08:16:33
【问题描述】:
很惊讶我自己找不到这个,但无论如何。假设我像这样使用我的网络用户控件:
<myprefix:mytag userid="4" runat="server">Some fancy text</myprefix:mytag>
我如何能够从其代码隐藏中访问标签内的文本(“一些花哨的文本”)?期待它通过 this.Text、this.Value 或类似的东西暴露出来。
编辑: 我什至在尝试使用它的页面上收到以下警告: 元素“mytag”的开始标签和结束标签之间不允许有内容。
EDIT2:
public partial class mytag: UserControl
{
public int ItemID { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
}
}
【问题讨论】:
标签: c# asp.net web-user-controls