CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: Date Entered: 9/5/2005 4:00:11 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 41 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"Jeff" <>
NewsGroup User
Why is my data-bound templated control so slow?9/5/2005 4:00:11 AM

0

I've been working on a templated control, and I'm astounded at how slow it is. I looked at the execution times and narrowed it down to the actual data binding of a particular item...

TemplateItem item = new TemplateItem();
item.DataItem = simpleContainerClass;
ITemplate template;
if (_postTemplate != null)
{
    template = _postTemplate;
    template.InstantiateIn(item);
    this.Controls.Add(item);
}
item.DataBind();


This block of code runs once for each item in the collection of data items in the control's CreatChildControls() method. The TemplateItem class is just a container class with one property called DataItem. The last line, the DataBind() method, takes nearly .1 seconds for each item. That's obviously not acceptable.

Am I missing something here or is there just something slow about using this? I'm using v2 of .NET, by the way.

Jeff "Jones" Putz
Go from beginner to guru: Maximizing ASP.NET
uber:ASP.Net
"Eilon" <>
NewsGroup User
Re: Why is my data-bound templated control so slow?9/29/2005 7:05:32 PM

0

When you call DataBind() on the item, any databinding expressions that exist in the template are executed. For example, in this expression:
   <%# Eval("Name") %>
The Eval() method will be called. This uses Reflection to evaluate the "Name" property of the current data item. Although you might be thinking that Reflection is slow, believe me, it's not *that* slow! :)

However, if the "getter" of the "Name" property is very slow, that might be the cause of the overall slowness. For example, if it goes to a database every time you get the value of the property, that would very well explain it.

Can you take a look at what the contents of the template are and perhaps what exactly is being databound in there?

Thanks,
Eilon


Blog: http://weblogs.asp.net/LeftSlipper/
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:













how to access properties of datagrid control

customizing the asp.net 2.0 wizard control

webcontrol properties

looking for cheap web hosting

why is processpostdata called twice?

problems with files when uploaded

composite control problem with bubble events

application aborts: faulting module mscorwks.dll, version 2.0.50727.4062,

changing property based on event

hosting for learning and working

issue with validators as child controls

pls help to fix my hd problem!! help!

mvc hosting, asp.net mvc hosting, who's valued?

page_load in usercontrols

page and its variables

custom control property

location of web control(s) in whidbey

re: custom server control designer icon

using components as data sources in design time

anyone hosting with ucvhost.com?

referencing server controls within usercontrols

custom calendar control

usercontrols and properties

writing a client function shared by similar validators

dynamic composite control viewstate problem

are windows hosting companies ready for ruby and ruby on rails

parallels.com hosting : server error in '/' application

check childnodes when checking parentnode in treeview

hosting need of asp 2.0 and sql 2005

ipostbackdatahandler.loadpostdata not firing

designer attribute not working

another tool

loadpostdata - custom child controls first?

how can i detect the cause of postback from within my server control?

advise: i have t1 and shared host

render at desing time in webcontrol

trying to create my first server side control and need help

advanced adrotator: things you wished adrotator did?!?!

designtimeelement of readwritecontroldesigner/paneldesigner

my custom checkbox control doesnt give me the right checked value, when inside another control

how to share data between a user control and the page ?

getting values from other controls...

clarification needed for spla hosting of windows terminal services

exposing textbox properties in a server control

tablerows and inamingcontainer

property lists

help my webcontrol about itemplate.....please

add web control

what firewall or other security to use?

((button)sender).backcolor.tostring();

   
  Privacy | Contact Us
All Times Are GMT