protected string myfunction() {
return "abc";
}
In one of my pages I can show the "abc" in the webpage by using <%# myfunction() %>. But in another page it doesn’t work unless I use <%=myfunction(); %> instead.
What is the difference and why?
Thanks a lot!
<%= myfunction(); %>would be used to output the return value ofmyfunctionin a page.<%# myfunction(); %>would be used to output the return value ofmyfunctionin a control that is data bound (for example, inside an asp repeater control).Take a look at this overview for more information on data binding.