Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Why is my dynamically added TemplCol so slow?

Reply
Thread Tools

Why is my dynamically added TemplCol so slow?

 
 
Justin Dutoit
Guest
Posts: n/a
 
      07-26-2003
Hey. I'd appreciate if someone could improve the performance of my
TemplateColumn. It runs nicely with one template, and very slow with
another.

If you could please look at my page-
http://eu.webmatrixhosting.net/justi...3.aspx?multipl
esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09

Now if I use a different template, it's much faster:

http://eu.webmatrixhosting.net/justi...2.aspx?multipl
esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09

I would be thankful if someone could tell me why BufferOff3.aspx is slow,
and BufferOff2.aspx is fast. Here are the two templates, first the slow one:

l.Text = "<A href=\"javascript:void(0)\" onclick=\"parent.left.buyItem('"
+
((DataRowView)container.DataItem)["productnumber"].ToString() +
"', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
"', '" + ((DataRowView)container.DataItem)["productname"].ToString() +
"', '" + ((DataRowView)container.DataItem)["price"].ToString() +
"');\"><img src='add2.jpg' border=0
onmouseover=this.src='add2mouseover.jpg' onmouseout=this.src='add2.jpg'
title='Click to buy one of this item'></A>";

--- and here is the fast one ---


l.Text = "In brackets[" +
((DataRowView)container.DataItem)["productnumber"].ToString() +
"', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
"', '" + ((DataRowView)container.DataItem)["productname"].ToString() +
"', '" + ((DataRowView)container.DataItem)["price"].ToString() +
"]";


It doesn't matter whether I use LoadTemplate or inherit from ITemplate and
use new MyTemplateColumn, my template column is still way too slow.

(I tried two methods of adding a template column in code:
http://www.dotnetbips.com/displayarticle.aspx?id=84
which is LoadTemplate from an ascx file, and
http://www.dotnetbips.com/displayarticle.aspx?id=85
which is to roll your own ITemplate, and use New MyTemplateColumn.)

Here is the code which creates the column:

Dim MyTemplate As ITemplate = New MySlowTemplateColumn("brand")
Dim ColumnBuy As TemplateColumn = New TemplateColumn
ColumnBuy.HeaderText = "&nbsp;Buy&nbsp;"
ColumnBuy.ItemTemplate = MyTemplate
NextGrid.Columns.Add(ColumnBuy)



 
Reply With Quote
 
 
 
 
Justin Dutoit
Guest
Posts: n/a
 
      07-26-2003
I removed the <IMG> tag from my template, and the performance is much
better. I still want to keep that image, but the cause seems to be isolated
....

Tks
Justin
"Justin Dutoit" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hey. I'd appreciate if someone could improve the performance of my
> TemplateColumn. It runs nicely with one template, and very slow with
> another.
>
> If you could please look at my page-
>

http://eu.webmatrixhosting.net/justi...3.aspx?multipl
> esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09
>
> Now if I use a different template, it's much faster:
>
>

http://eu.webmatrixhosting.net/justi...2.aspx?multipl
> esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09
>
> I would be thankful if someone could tell me why BufferOff3.aspx is slow,
> and BufferOff2.aspx is fast. Here are the two templates, first the slow

one:
>
> l.Text = "<A href=\"javascript:void(0)\"

onclick=\"parent.left.buyItem('"
> +
> ((DataRowView)container.DataItem)["productnumber"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["productname"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["price"].ToString() +
> "');\"><img src='add2.jpg' border=0
> onmouseover=this.src='add2mouseover.jpg' onmouseout=this.src='add2.jpg'
> title='Click to buy one of this item'></A>";
>
> --- and here is the fast one ---
>
>
> l.Text = "In brackets[" +
> ((DataRowView)container.DataItem)["productnumber"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["productname"].ToString() +
> "', '" + ((DataRowView)container.DataItem)["price"].ToString() +
> "]";
>
>
> It doesn't matter whether I use LoadTemplate or inherit from ITemplate and
> use new MyTemplateColumn, my template column is still way too slow.
>
> (I tried two methods of adding a template column in code:
> http://www.dotnetbips.com/displayarticle.aspx?id=84
> which is LoadTemplate from an ascx file, and
> http://www.dotnetbips.com/displayarticle.aspx?id=85
> which is to roll your own ITemplate, and use New MyTemplateColumn.)
>
> Here is the code which creates the column:
>
> Dim MyTemplate As ITemplate = New MySlowTemplateColumn("brand")
> Dim ColumnBuy As TemplateColumn = New TemplateColumn
> ColumnBuy.HeaderText = "&nbsp;Buy&nbsp;"
> ColumnBuy.ItemTemplate = MyTemplate
> NextGrid.Columns.Add(ColumnBuy)
>
>
>



 
Reply With Quote
 
 
 
 
Justin Dutoit
Guest
Posts: n/a
 
      07-27-2003
No, it's not the highlighting on moouseover that is slow, it seems that the
template loads much slower, so the rendering of the grid is slow....

Justin

"Prasad" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> Hi
>
> Try preloading the images in JavaScript. so that it will be faster.
>
> HTH
> Prasad
> "Justin Dutoit" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > I removed the <IMG> tag from my template, and the performance is much
> > better. I still want to keep that image, but the cause seems to be

> isolated
> > ...
> >
> > Tks
> > Justin
> > "Justin Dutoit" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hey. I'd appreciate if someone could improve the performance of my
> > > TemplateColumn. It runs nicely with one template, and very slow with
> > > another.
> > >
> > > If you could please look at my page-
> > >

> >

>

http://eu.webmatrixhosting.net/justi...3.aspx?multipl
> > > esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09
> > >
> > > Now if I use a different template, it's much faster:
> > >
> > >

> >

>

http://eu.webmatrixhosting.net/justi...2.aspx?multipl
> > > esearch=milk%2C+bread%2C+juice%2C+cheese%2C%09
> > >
> > > I would be thankful if someone could tell me why BufferOff3.aspx is

> slow,
> > > and BufferOff2.aspx is fast. Here are the two templates, first the

slow
> > one:
> > >
> > > l.Text = "<A href=\"javascript:void(0)\"

> > onclick=\"parent.left.buyItem('"
> > > +
> > > ((DataRowView)container.DataItem)["productnumber"].ToString() +
> > > "', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
> > > "', '" +

((DataRowView)container.DataItem)["productname"].ToString()
> +
> > > "', '" + ((DataRowView)container.DataItem)["price"].ToString() +
> > > "');\"><img src='add2.jpg' border=0
> > > onmouseover=this.src='add2mouseover.jpg'

onmouseout=this.src='add2.jpg'
> > > title='Click to buy one of this item'></A>";
> > >
> > > --- and here is the fast one ---
> > >
> > >
> > > l.Text = "In brackets[" +
> > > ((DataRowView)container.DataItem)["productnumber"].ToString() +
> > > "', '" + ((DataRowView)container.DataItem)["brand"].ToString() +
> > > "', '" +

((DataRowView)container.DataItem)["productname"].ToString()
> +
> > > "', '" + ((DataRowView)container.DataItem)["price"].ToString() +
> > > "]";
> > >
> > >
> > > It doesn't matter whether I use LoadTemplate or inherit from ITemplate

> and
> > > use new MyTemplateColumn, my template column is still way too slow.
> > >
> > > (I tried two methods of adding a template column in code:
> > > http://www.dotnetbips.com/displayarticle.aspx?id=84
> > > which is LoadTemplate from an ascx file, and
> > > http://www.dotnetbips.com/displayarticle.aspx?id=85
> > > which is to roll your own ITemplate, and use New MyTemplateColumn.)
> > >
> > > Here is the code which creates the column:
> > >
> > > Dim MyTemplate As ITemplate = New MySlowTemplateColumn("brand")
> > > Dim ColumnBuy As TemplateColumn = New TemplateColumn
> > > ColumnBuy.HeaderText = "&nbsp;Buy&nbsp;"
> > > ColumnBuy.ItemTemplate = MyTemplate
> > > NextGrid.Columns.Add(ColumnBuy)
> > >
> > >
> > >

> >
> >

>
>



 
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
Dynamically-added Button not triggering event handler. Why? parsifal ASP .Net 4 03-15-2007 04:57 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Inserting Controls Dynamically - with Validators Also Added Dynamically Jeffrey Todd ASP .Net 1 06-02-2005 04:33 PM
how come user control added to page doesn't get added to codebehind file? Bennett Haselton ASP .Net 1 11-08-2004 09:26 PM



Advertisments