473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Inline output in pages

Hi,

In an .aspx file, is there any clear/concise documentation about the
difference between the following:
<%$ [...]
<%= [...]
<%# [...]

and where we can use them?

How are those called?

Thanks!

Mike
Jun 27 '08 #1
2 808
The
<%= is a substitute for Response.Write
So <%= a%is exactly the same as <%Response.Write(a)%and executes only
during Render even, and is used to write something to browser
-----------------------------------------------
<%# is called data binding. <%# Methods%will be executed during so called
"binding". It's used to assign some value to property

Example:
<asp:label text='<%# MyValue %>' runat="server"/>
You can not write here <%= instead of <%# simply because it will not make
sense. You want to assign to text property of the label the value of
MyValue.

PS. to kick of execution of data binding you need to call Page.DataBind();

The most common use for <%# is in DataGrid and such. When you write
<asp:TemplateColumn HeaderText="FAQ Information">
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem, "ColumnName") %></b>
</ItemTemplate>
</asp:TemplateColumn>this code is actually assignment to the ItemTemplate
property. so you can not use <%= instead.PS: You do not need to call
Page.DataBind() in this case but you do need to call MyGrid.DataBind() for
assignment to actually happen. (Of course if you do not have Page scope
biding
elements) -----------------------------------------------------------------
The
<%$ is the synonymous for pulling value from the resource (or web.config ).
My understanding that it happens during compile time. And not runtime.
So you can not write someting like
"<%$ ConnectionStrings:GetMyConnection()%>"
Becuase GetMyConnection is evaluated during parse time and your code is not
running at that time.

George
"Mike Gleason jr Couturier" <no****@invalidhost.comwrote in message
news:ee**************@TK2MSFTNGP02.phx.gbl...
Hi,

In an .aspx file, is there any clear/concise documentation about the
difference between the following:
<%$ [...]
<%= [...]
<%# [...]

and where we can use them?

How are those called?

Thanks!

Mike

Jun 27 '08 #2
"George Ter-Saakov" <gt****@cardone.coma écrit dans le message de news:
%2******************@TK2MSFTNGP04.phx.gbl...
The
<%= is a substitute for Response.Write
So <%= a%is exactly the same as <%Response.Write(a)%and executes only
during Render even, and is used to write something to browser
-----------------------------------------------
<%# is called data binding. <%# Methods%will be executed during so
called "binding". It's used to assign some value to property

Example:
[...]
Thank you very much, it is now 100% clear in my head, thanks again!

Mike
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xtr | last post by:
Hello, Is it possible, using xsl, to indent most tags, but preserve the position of tags that are inline (surrounded by text)? For example, given the following,: ...
23
by: Mat | last post by:
<div id="container"> <div id="main"> <div id="header"> <p class="Address">123 Fake Street, </p> <p class="City">Crazy City, </p> <p class="Province">Ontario </p> <p class="PostalCode">H0H...
20
by: qazmlp | last post by:
My class in a header file, contains inline virtual destructor. Is this Ok? Can it cause any problems? class base { public: base() { } virtual ~base { std::cout<<"Inside virtual destructor\n";...
11
by: Markus Ernst | last post by:
Hi Does somebody know a workaround for the fact that IE5 does not apply margin and padding to inline elements? I have a navigation with those styles: ul#navigation { border-top:1px #000000...
18
by: Method Man | last post by:
If I don't care about the size of my executable or compile time, is there any reason why I wouldn't want to inline every function in my code to make the program run more efficient?
5
by: Ondrej Spanel | last post by:
I though that inline functions should be always visible only in the compilation unit where they are defined - meaning if compiler cannot inline them, they should be handled as if declared static....
5
by: Bert Jansen | last post by:
There seems to be a bug in de VS .net C++ compiler (optimization) when using inline functions that return static data. The following code demonstrates this (Win32 console app with ATL support): ...
8
by: neilmcguigan | last post by:
I just wanted to list some reasons why I prefer inline code to code-behind. 1. you can fix some bugs more quickly. remote desktop into server, change the aspx file, and she's good to go. I'd say...
3
by: MIS Director | last post by:
Is there any tool out there that will analyze an entire website and produce a report of inline style usages by both total count and detail occurrances. This would produce a list of possible...
4
by: raashid bhatt | last post by:
hi by the definition of inline functions "In computer science, an inline function is a programming language construct used to suggest to a compiler that a particular function be subjected to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.