J
Justin Dutoit
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/justindutoit/test/testBufferOff3.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/justindutoit/test/testBufferOff2.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 = " Buy "
ColumnBuy.ItemTemplate = MyTemplate
NextGrid.Columns.Add(ColumnBuy)
TemplateColumn. It runs nicely with one template, and very slow with
another.
If you could please look at my page-
http://eu.webmatrixhosting.net/justindutoit/test/testBufferOff3.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/justindutoit/test/testBufferOff2.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 = " Buy "
ColumnBuy.ItemTemplate = MyTemplate
NextGrid.Columns.Add(ColumnBuy)