<%# GetDeptHeader() %is the syntax for databinding. Databinding
expressions are evaluated when you call DataBind() method of the page.
Usually you would databind to a property rather than to a method. So in your
case you would make a public property called DeptHeader, rewrite the
expression as <%# DeptHeader %and call the DataBind method.
<% GetDeptHeader() %runs GetDeptHeader() on page rendering stage but it
doesn't return the result into the <%..%block. <% =GetDeptHeader() %will
do.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Nobody" <no****@cox.netwrote in message
news:EI*******************@newsfe08.phx...
>I want to call a function in the code behind .CS page from the .aspx page:
<a><%# GetDeptHeader() %></a>
basically I want it to display the string returned from GetDeptHeader().
With the link formated like above, GetDeptHeader() doesn't even get
called. If I change it to:
<a><% GetDeptHeader() %></a>
then it gets called, but it never displays the string... this is the
function:
protected string GetDeptHeader()
{
return "Test";
}