asp labels -- how to avoid a databind() call?

S

Steve Hershoff

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top