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