tags:

views:

76

answers:

1
protected string myfunction() {
   return "abc";
}

In on of my page, I can show the "abc" in the webpage by using <%# myfunction() %>. But In other page, It doesn't work, but work by using <%=myfunction(); %>.

Why and what is the different?

Thanks a lot!!

+5  A: 

<%= myfunction(); %> would be used to output the return value of myfunction in a page.

<%# myfunction(); %> would be used to output the return value of myfunction in 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.

adrianbanks