Binding a non collection class in ASP.NET

H

hsomob1999

I retreive a class in my code behind and would like to bind it to a
label and some <td>'s.
Idealy I would like to say:
<asp:label .....><%#myClass.publicProperty%></asp:label>
but myClass is retreived in a codebehind sub.
Since the class doesnt implement IEnum or isnt contained in some
container ( its an instance of a single Employee ) I cant use
Label.DataBind().

I have thought to make a sub in my code behind called getEmployee()
then in the asp page say that inherrits from it say:
<%
e = getEmployee()
label1.text = e.name
%>

etc....

but would like to keep with the format of the other data on my page and
bind it.
That being said I would also like to avoid making public properties on
my code behind and and say stuff like <asp:label
....><%#getName()%></asp:label>
or making asignments from my code behind like
Label1.text = e.Name()

Any Ideas?
Thanks
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top