Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2009, 09:06 PM
Authorized User
 
Join Date: Jul 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default General Question: <%# vs <%=

Note: If this is the wrong forum for this question please just simply state the forum I should post in.

What's the difference between <%=... and <%#...

You may have discussed this earlier in the book but I couldn't find it.
 
Old August 13th, 2009, 09:48 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default Basically...

I'm sure Imar will have a much better explanation but basically <%= is the same as using Response.Write you are basically writting a string out to that spot.

<%# is accessing a data object

hopefully that helps a little bit.
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old August 13th, 2009, 11:47 PM
Authorized User
 
Join Date: Jul 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, yes it does.

I've been playing around with it and it appears that the following "Might" be true "Please correct me if I'm wrong"

<%# is used with server controls and <%= are used with HTML controls. For instance I cannot access the code Behind when I use <%= but I can when I use <%# (I could also be doing something wrong)
 
Old August 14th, 2009, 05:00 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Nope, it's not about server controls versus HTML controls. As alliancejhall pointed out, it's about databinding (<%#) versus Response.Write (<%=)

Data binding expressions are evaluated long before output is sent to the browser in data binding scenarios while Response.Write direct outputs content to the response stream.

You may want to read the following articles (and follow some of the links to more detailed pages) to find out more about the differences:

http://stackoverflow.com/questions/1...ce-between-and
http://www.velocityreviews.com/forum...and-lt-gt.html

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with <SELECT <OPTION pegarr Classic ASP Basics 8 May 14th, 2008 09:49 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
Where can i download <<Fast Track ADO.NET C! Editi liuxiao_lx123 Wrox Book Feedback 1 June 21st, 2004 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.