Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-23
1
Medium Priority
?
251 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

718 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