Solved

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

Posted on 2008-10-23
1
243 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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 …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now