Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Differences Between......

Reply
Thread Tools

Differences Between......

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      04-19-2007
Assuming that a DataGrid gets populated by a database column named
RegDate using a DataSet, what's the difference between

<%# DataBinder.Eval(Container.DataItem, "RegDate") %>

&

<%# Container.DataItem("RegDate") %>

If I am not wrong, the former can be used to format the output like
for e.g.

<%# DataBinder.Eval(Container.DataItem, "RegDate", "{0:d}") %>

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      04-19-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Assuming that a DataGrid gets populated by a database column named
> RegDate using a DataSet, what's the difference between
>
> <%# DataBinder.Eval(Container.DataItem, "RegDate") %>
>
> &
>
> <%# Container.DataItem("RegDate") %>
>
> If I am not wrong, the former can be used to format the output like
> for e.g.
>
> <%# DataBinder.Eval(Container.DataItem, "RegDate", "{0:d}") %>
>


The Eval method uses reflection to read the "RegDate" item from the
Container.DataItem object, so the result is the same.

You can use formatting when reading the value directly also:

<%# String.Format("{0:d}", Container.DataItem("RegDate")) %>

--
Göran Andersson
_____
http://www.guffa.com
 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      04-19-2007
And DataBinder.Eval is a performance hit. As Göran says, it uses reflection
to determine the type, and reflection is a more intensive activity. If you
can avoid using the Eval method, do it as it will help boost performance of
your web app slightly.


--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Assuming that a DataGrid gets populated by a database column named
> RegDate using a DataSet, what's the difference between
>
> <%# DataBinder.Eval(Container.DataItem, "RegDate") %>
>
> &
>
> <%# Container.DataItem("RegDate") %>
>
> If I am not wrong, the former can be used to format the output like
> for e.g.
>
> <%# DataBinder.Eval(Container.DataItem, "RegDate", "{0:d}") %>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DEVELOP THE WINNING EDGE, SMALL DIFFERENCES IN YOUR PERFORMANCE CANLEAD TO LARGE DIFFERENCES IN YOUR RESULTS Home_Job_opportunity C Programming 0 01-14-2009 03:51 PM
DEVELOP THE WINNING EDGE, SMALL DIFFERENCES IN YOUR PERFORMANCE CANLEAD TO LARGE DIFFERENCES IN YOUR RESULTS Home_Job_opportunity C Programming 0 01-08-2009 04:31 PM
differences between Mozilla, Firefox and Thunderbird Anthony Boor Firefox 1 07-01-2004 10:17 PM
Differences between Mozilla 1.5, etc., and Firebird? Larry G Firefox 13 12-03-2003 08:11 PM
File Save Differences Between Win98 and Win2K Scott Gravenhorst Firefox 2 11-26-2003 12:30 AM



Advertisments