Solved

What's the difference between <% %> and <%# %> ???

Posted on 2008-10-23
1
248 Views
Last Modified: 2012-05-05
Hello,

Could some one explain me what's the difference between:

<% ... some asp.net code %>

and

<%# ... some asp.net code %>

What's the # for?

Thanks in advance.
0
Comment
Question by:richardhaeger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
GreymanMSC earned 100 total points
ID: 22790976
The first simply executes inline ASP code at that point in the HTML rendering.  It is generally placed in innerHTML, as if it were an HTML tag in its own right.
The second performs databinding on Eval() or Bind() calls.  It is generally placed in the value of an attribute  of an ASP control, that itself is inside a Databound Container Control, and the # symbol escentially means: bind the result of this code to the value of the control attribute containing it.

<% If Me.chkSayHellow.Checked Then Response.Write('Hello World') %>
 
<asp:Label ID=lblWhatAmI runat=server Text='<%# Eval('WhatAmI') %> />

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question