DataGrid Efficency of setting embeded control properties inline or with codebehind

E

Earl Teigrob

I have a DataGrid that needs to set many properites on its embeded controls
in the ItemTemplate and EditItemTemplate Templates. I have a choice between
using the inline <%# %> or the OnItemCreated / OnDataBound codebehind events
to set these properties. Is one way more effiecent then the other? I know
from classic ASP that doing a lot of context switching within a page was not
very efficient. Is that still that case in this senerio?

Thank you for your help

Earl
 
S

Scott Allen

Hi Eerl:

In asp.net there is no overhead in <% %> switching as in ASP days.
There can be, however, some additional overhead if you are using a lot
of DataBinder.Eval inside of the blocks versus writing code in the
code-behind.

In the end you'll have to measure the difference usng your specific
code, since "a lot" and "many properties" are relative terms.

I'd chose what feels best from a maintenance perspective and work from
there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top