C# 代码块+;asp.net自定义控件中的文本
我现在正在搜索两天,以完成以下任务: 我想要一个自定义控件,它将采用内联文本+代码块 我想要实现的示例:C# 代码块+;asp.net自定义控件中的文本,c#,asp.net,C#,Asp.net,我现在正在搜索两天,以完成以下任务: 我想要一个自定义控件,它将采用内联文本+代码块 我想要实现的示例: <asp:MyCustom runat="server"> Hello there, <%= User.Name%> </asp:MyCustom> 除此之外,该控件实际上是父用户控件列表的一个成员,该控件继承自“UserControl”,覆盖Render方法。此外,还有一个类StringITemplate,它还允许将普通字符串指定给ITempl
<asp:MyCustom runat="server">
Hello there, <%= User.Name%>
</asp:MyCustom>
除此之外,该控件实际上是父用户控件列表的一个成员,该控件继承自“UserControl”,覆盖Render方法。此外,还有一个类StringITemplate,它还允许将普通字符串指定给ITemplate属性
最终,我希望实现以下目标:
<asp:MyCustomItemControl runat="server">
<Items>
<asp:Item>Hello there, <%= User.Name%></asp:Item>
<asp:Item><%= SomeOtherString%></asp:Item>
</Items>
</asp:MyCustom>
感谢阅读:)我只是在找这样的东西
我在这里找到了这个答案,它为我提供了答案:
答案总结如下:
<asp:MyCustomItemControl runat="server">
<Items>
<asp:Item>Hello there, <%= User.Name%></asp:Item>
<asp:Item><%= SomeOtherString%></asp:Item>
</Items>
</asp:MyCustom>