Why <%= %> works in one situation but not in another

后端 未结 6 2134
北恋
北恋 2020-12-28 08:21

This is stemming from a bad answer I gave last night. The curiosity as to why one method works and not the other is bugging me and I\'m hoping someone smarter than me can g

6条回答
  •  失恋的感觉
    2020-12-28 09:11

    <%= GetMyText("LabelText") %> basically means

    Response.Write(GetMyText("LabelText"));

    Here it is OK. <%= GetMyText("LabelText") %>

    However when you use this:

    
    

    It basically means:

    Label1.Text = Response.Write(GetMyText("LabelText"));

    which is a wrong statement.

提交回复
热议问题