Inline data

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

Is there a way to put inline data in a label?

For example, I would normally do something like this to put a name that I
have in my session variables in my asp:label:

Name.Text = Session("FullName")
....

<asp:Label ID ID="Name" runat="Server">

Can I get around the extra code by just doing something like (I know this
doesn't work):

<asp:Label ID="Name" Text='<%# session("FullName") %>' Runat="Server">

Similar to Binding to a variable, but get it directly from my session
variables?

Also, could I do a similar thing from a function (Obviously, if you can't do
the above - you probably can't do this):

<asp:Label ID="TotalAmount" Text='<%# MoneyFormat(Session("Total")) %>'
runat="Server"/>

Where MoneyFormat is a function I might use to format my session variable in
some money format.

Thanks,

Tom
 
tshad said:
Is there a way to put inline data in a label?

For example, I would normally do something like this to put a name that I
have in my session variables in my asp:label:

Name.Text = Session("FullName")
...

<asp:Label ID ID="Name" runat="Server">

Can I get around the extra code by just doing something like (I know this
doesn't work):

<asp:Label ID="Name" Text='<%# session("FullName") %>' Runat="Server">

Similar to Binding to a variable, but get it directly from my session
variables?

Also, could I do a similar thing from a function (Obviously, if you can't do
the above - you probably can't do this):

<asp:Label ID="TotalAmount" Text='<%# MoneyFormat(Session("Total")) %>'
runat="Server"/>

Where MoneyFormat is a function I might use to format my session variable in
some money format.

Thanks,

Tom

not really inline but you could do it with the page load event in an
"inline" style... would that suffice?
 
Curt_C said:
not really inline but you could do it with the page load event in an
"inline" style... would that suffice?

Your just saying to do the Name.Text = Session("FullName") in the Page_Load
notPostback?
 

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

Back
Top