Yes if you replace
<%# GetName() %>
with
<%= GetName() %>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Steve Hershoff" <> wrote in message
news:%...
> Hi everybody,
>
> I have a question about asp.net's labels and the DataBind method. I have
a
> method in a code-behind page (this is VisualStudio 2003 btw) that
> (simplified) looks like this:
>
> public string GetName()
> {
> string sName = "";
> if(Session["ds"] != null)
> sName = Session("fname").ToString() + " " +
> Session("lname").ToString();
> return sName;
> }
>
> My label code says this:
>
> <asp:Label CssClass="Normal2" Runat="server" ID="Label124">
> <%# GetName() %>
> </asp:Label>
>
> The thing is, I can't execute GetName() unless I call Label124.DataBind()
in
> my code-behind. Is there a way to do it without the DataBind() call?
>
>