开发者

call server function in server tag

开发者 https://www.devze.com 2023-02-06 02:28 出处:网络
can i call my function inside my server tag? public string Mytext() { } And <as开发者_开发知识库p:Label ID=\"lbl\" runat=\"server\" Text=\"Mytext()\"><asp:Label>

can i call my function inside my server tag?

public string Mytext()
{
}

And

<as开发者_开发知识库p:Label ID="lbl" runat="server" Text="Mytext()"><asp:Label>


You can do:

<asp:Label ID="lbl" runat="server"><%=Mytext()%><asp:Label>


Yes, using Expression syntax, e.g.,

<asp:Label ID="lbl" runat="server" Text="<%$ Mytext() %>"><asp:Label>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号