| |   Skin:   
      User: Not logged in 
Newsletter Signup
XSLT Library
Latest XML Blogs
Featured Examples
Featured Articles
Book Chapters
Training Courses
Sign In
My Profile
My Articles
My Examples
My Favorites
My Resources
Add a Resource
About Me
My Blog
HeadGeek Articles
Talking Portfolio
World Trip Pics

ASP.NET Tips and tricks - Databinding, Response.Write and <%=%> directive
Author: Duray AKAR
Published: 11/25/2005 11:17 PM
Category: ASP.NET
Summary: You will find this useful and easy if you are a little familiar with inline coding...


Databinding is a costly process on the server side.

Sometimes it is possible to avoid it for quite simple output parameters, such as request variables, dates e.t.c.

If you view HTML of an ASP.NET page, you will see directives like <%# [here goes the bound data evaluation] %>

The directives with a # sign in them, are evaluated ONLY during databinding, which is the most suitable evaluation for most of the time... Which means, if you do not call Page.DataBind() in your code, those values will NOT be assigned.

But there are cases that you want to simply display a request variable, or date and time let's say, on the page, which does not necessarily require data binding...

<%= %> directive would come to the rescue for those cases. For example <%= System.DateTime.Now.ToString() %> will output the current time even you DO NOT call Page.DataBind()... It is the directive that behaves similar to Response.Write()....

But remember that <%= %> directive values are evaluated during the rendering of the page, after the Page.PreRender event is fired... So use it carefully.

Hope it helps.

Duray AKAR


Fans of "The Office"
Dwight Bobbleheads are here!
  “It's me! I'm the bobblehead! Yes!”

Advertise on XMLPitstop

Advertise on XMLPitstop

EggHead Cafe
Web Servicee development
Buy text ads here!
remote file backup
Color Laser Printer
Fendi sunglasses
Skype vs. sipcall
VoIP Internettelefonie
Buy text ads here!

Interested in Text ads?
2,223 Total Members
36 members(last 30 days)
8 members(last 7 days)
2 members(today)

1,609 Total Discussions
12 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

17,260 Total Blog Posts
1,839 Blogs(last 30 days)
342 Blogs(last 7 days)
49 Blogs(today)

8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

13,786 Total Resources
5 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)


David Silverlight's| 2801 Florida Ave #225|Miami, FL 33133|Ph:305-447-1139