How do I make my ASP.NET server control take an embedded code block as a property value?

后端 未结 5 1286
星月不相逢
星月不相逢 2020-12-30 14:07

I have a custom server control with a property of Title. When using the control, I\'d like to set the value of the title in the aspx page like so:



        
5条回答
  •  佛祖请我去吃肉
    2020-12-30 14:52

    You cant. <%= %> will write the string directly to the response-stream, which happens after the server control is constructed. See this post for an explanation.

    So its either codebehind, or <%# + databinding as Zachary suggests.

提交回复
热议问题