asp.net function inside html?

  • Thread starter Thread starter rom
  • Start date Start date
R

rom

Hi,

In the old day we could write:
<td><% getCellData() %></td>

now when I try:
<td><%# getCellData() %></td>

I get nothing.....What is the reason for that? Is there a
way to combine html text with asp.net functions?
 
rom said:
Hi,

In the old day we could write:
<td><% getCellData() %></td>

now when I try:
<td><%# getCellData() %></td>

I get nothing.....What is the reason for that? Is there a
way to combine html text with asp.net functions?

what if you try plain old <td><% getCellData() %></td> ?
(the extra "#" has a special meaning, for "databinding")

Hans Kesting
 
Still doesn't work, but I if you're asking then I
understand that it should work. 2 questions then - why
doesn't it work(maybe some special tag that I have to add
at the top of the aspx page?) and the second question - is
that the "correct" way to do such things??? by using the
old way?
 
try
<%= getCellData()%> this will return your property value

Cheers
 
=getCellData()
will "print" the result of the function else you call the function but does
nothing with its results.

In ASP.NET, it's likely considered best to avoid interleaving HTML and
programming code. The basic idea of ASP.NET is to provide a server side
programming object model that allows to handle programmatically various
parts of the page....

Patrice


--
 
there are two type of reffering a variable in your page.

<%= %> this will take the info from your code behind if this exista as
variable, property or method in your page
or
<%# %> is used usually at binding data
All data binding expression, regardless of where you place them,
must be contained in <%# and %> characters.
in this case you should use databind in your code behinde.

cheers
 
Thanks!
-----Original Message-----
=getCellData()
will "print" the result of the function else you call the function but does
nothing with its results.

In ASP.NET, it's likely considered best to avoid interleaving HTML and
programming code. The basic idea of ASP.NET is to provide a server side
programming object model that allows to handle programmatically various
parts of the page....

Patrice


--




.
 

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