I'm largely basing it on my own observation of both methods (I've used both
back and forth, and am currently (obviously) in the n-tier wins side).
I've read in a number of blogs and blog comments that it's a hit anywhere
from 10-20%. Assuming that's true, it's highly situational, based on how
large the data set is. I guess my warning should be worded better:
Be aware that using DataBinder.Eval has a performance penalty proportional
to the way you are using (width (columns) and size (rows) of the data).
However, it provides greater layer seperation and makes your code easier to
maintain and less brittle. You should pick the best method for your given
scenerio. Personally, I tend to value maintainability far more than
performance and will use the more maintainable approach first, profile, and
only adjust for performance when deemed necessary.
I like to make sure people understand both sides of a coin and make the best
choice for their situation....I think you and I do a decent job on that on
here
Cheers,
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Eliyahu Goldin said:
Karl,
I saw your opinion on this in your other posts. The MSDN on the Eval
method
warns:
CAUTION Since this method performs late-bound evaluation, using
reflection, at runtime, it can cause performance to noticeably slow
compared
to standard ASP.NET data-binding syntax.
Are you aware of any performance tests proving that the performance
penalty
is minor rather then noticeable?
Eliyahu
Karl Seguin said:
I'd generally recommend the late-bound DataBinder.Eval method rather then
the early-bound casting. I think the minor performance penalty paid is well
worth it for the clean layer seperation. Why should your presentation
layer be aware of the underlying data source? Early-binding in this case
means you can't change simply change your business layer without
affecting
everything else...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Text="<%#
((System.Data.Common.DbDataRecord)Container.DataItem)["productname
"] %>"
or
Text="<%# ((System.Data.Common.DbDataRecord)Container.DataItem)[0] %>"
Eliyahu
message
I have a DataGrid with a checkbox as ItemTemplate....
<asp

ataGrid id="Datagrid3" runat="server"
AutoGenerateColumns="False"
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="Chk" Text="<%# Container.DataItem %>"
runat="server">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp

ataGrid>
in my codebehind file I have a query
Select productname form product, the results of which are held in a
DataReader
and the DataReader is the source of Data for Datagrid3.
Query exectues fine but on the page I get the following instead of the
actual data.
System.Data.Common.DbDataRecord.
What am I doing wrong?
Thanx in advance.