i made a composite control whish generate image around data (a panel decorate automaticly with image)
but it s realy slow on ie7 when i resize the client or when i have for example an accordion into the panel (its slow when the panel need to resize himselft )
do i made something wrong ?? here is the render code
public class PanelItem : CompositeControl
{ }
public class ExtendablePanel : CompositeControl
{
private ITemplate _itemTemplate;
private ITemplate _headerTemplate;
private ITemplate _footerTemplate;
[TemplateContainer(typeof(PanelItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate FooterTemplate
{
get { return _footerTemplate; }
set { _footerTemplate = value; }
}
[TemplateContainer(typeof(PanelItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate HeaderTemplate
{
get { return _headerTemplate; }
set { _headerTemplate = value; }
}
[TemplateContainer(typeof(PanelItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate ItemTemplate
{
get { return _itemTemplate; }
set { _itemTemplate = value; }
}
I'm not sure, but I think there are some specific JavaScript that runs slower on IE7 than on other browsers. It may be some specific constructs, functions or ineffiecient use of JavaScript.
Why I'm telling that, is because I've also seen some sites which run extremely slow on IE7, but rather fine on other browsers. They use some very old and legacy javascript.
If there is structue is not proper than also it may take time to render.
Thanks for the tip :). This may very well be the reason to the problem I described previously, because in my case the site is pretty old and HTML is not quite valid and pages contain very large amount of html (many big tables mixed with other elements and
script tags all over the page).
therealbappy...
0 Points
5 Posts
why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 08:57 AM|LINK
Hi,
i made a composite control whish generate image around data (a panel decorate automaticly with image)
but it s realy slow on ie7 when i resize the client or when i have for example an accordion into the panel (its slow when the panel need to resize himselft )
do i made something wrong ?? here is the render code
public class PanelItem : CompositeControl { }public class ExtendablePanel : CompositeControl {private ITemplate _itemTemplate; private ITemplate _headerTemplate; private ITemplate _footerTemplate; [TemplateContainer(typeof(PanelItem))] [PersistenceMode(PersistenceMode.InnerProperty)] public ITemplate FooterTemplate { get { return _footerTemplate; } set { _footerTemplate = value; } } [TemplateContainer(typeof(PanelItem))] [PersistenceMode(PersistenceMode.InnerProperty)] public ITemplate HeaderTemplate { get { return _headerTemplate; } set { _headerTemplate = value; } } [TemplateContainer(typeof(PanelItem))] [PersistenceMode(PersistenceMode.InnerProperty)] public ITemplate ItemTemplate { get { return _itemTemplate; } set { _itemTemplate = value; } }protected override void CreateChildControls() { Controls.Clear(); // -- had header -- StringBuilder start = new StringBuilder("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width:"+Width+"\">"); start.Append("<tr style=\"height:" + CornerHeight + "\"><td align=\"right\" valign=\"top\"style=\"width:" + CornerWidth + ";height:" + CornerHeight + ";background-image:url('" + TopLeftImage + "');background-repeat:no-repeat;\"></td>"); // -- insert left top image -- start.Append("<td style=\"background-image:url('" + TopImage + "');background-repeat:repeat-x;\">"); Controls.Add(new LiteralControl(start.ToString())); if (_headerTemplate != null) { PanelItem p = new PanelItem(); //p.ID="panelitem"; _headerTemplate.InstantiateIn(p); Controls.Add(p); } start = new StringBuilder("</td>"); start.Append("<td align=\"left\" valign=\"top\"style=\"width:" + CornerWidth + ";height:" + CornerHeight + ";background-image:url('" + TopRightImage + "');background-repeat:no-repeat;\"></td></tr>"); // -- had content start.Append("<tr><td align=\"right\" style=\"width:" + CornerWidth + ";background-image:url('" + LeftImage + "');background-repeat:repeat-y;\"></td>"); if (MiddleImage != null) start.Append("<td align=\"left\" valign=\"top\" style=\"background-image:url('" + MiddleImage + "');background-repeat:repeat;\">"); else start.Append("<td align=\"left\" valign=\"top\" style=\"background-color:" + ContentBackColor + "\">"); Controls.Add(new LiteralControl(start.ToString())); if (_itemTemplate != null) { PanelItem p = new PanelItem(); //p.ID="panelitem"; _itemTemplate.InstantiateIn(p); Controls.Add(p); } start = new StringBuilder("</td>"); start.Append("<td align=\"left\" style=\"width:" + CornerWidth + ";background-image:url('" + RightImage + "');background-repeat:repeat-y;\"></td></tr>"); // -- had footer start.Append("<tr style=\"height:" + CornerHeight + "\"><td align=\"right\" valign=\"top\"style=\"width:" + CornerWidth + ";height:" + CornerHeight + ";background-image:url('" + DownLeftImage + "');background-repeat:no-repeat;\">"); // -- insert left down image -- start.Append("</td><td style=\"background-image:url('" + DownImage + "');background-repeat:repeat-x;\">"); Controls.Add(new LiteralControl(start.ToString())); if (_footerTemplate != null) { PanelItem p = new PanelItem(); //p.ID = "panelitem"; _footerTemplate.InstantiateIn(p); Controls.Add(p); } start = new StringBuilder("</td><td align=\"left\" valign=\"top\"style=\"width:" + CornerWidth + ";height:" + CornerHeight + ";background-image:url('" + DownRightImage + "');background-repeat:no-repeat;\"></td></tr></table>"); Controls.Add(new LiteralControl(start.ToString())); }thx
SGWellens
All-Star
126031 Points
10310 Posts
Moderator
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 12:30 PM|LINK
If Script Debugging is enabled in IE, it will run slower.
My blog
therealbappy...
0 Points
5 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 12:44 PM|LINK
well, nice try but debugging is disable.
therealbappy...
0 Points
5 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 12:47 PM|LINK
i have found that it s this portion of code slow the process...
if (_itemTemplate != null) { PanelItem p = new PanelItem(); //p.ID="panelitem"; _itemTemplate.InstantiateIn(p); Controls.Add(p); }my PanelItem is just an empty class inherit from compositecontrol.
do i have to implement event in it or just leave empty ?
dinoboy
Member
542 Points
105 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 12:51 PM|LINK
I'm not sure, but I think there are some specific JavaScript that runs slower on IE7 than on other browsers. It may be some specific constructs, functions or ineffiecient use of JavaScript.
Why I'm telling that, is because I've also seen some sites which run extremely slow on IE7, but rather fine on other browsers. They use some very old and legacy javascript.
therealbappy...
0 Points
5 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 12:58 PM|LINK
thx.... but i got no javascript...
therealbappy...
0 Points
5 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 01:16 PM|LINK
ok, i have found....the solution but doesn't understand why ie7 do something like that.....
the solution is to simply resize up my top,left,right and bottom image from 1px*48px to something big (50px*48px)
in my case, ie seems to duplicate image x300 if i have repeat-x or y in my css and a panel of 300px.
if someone has the raison , i ll be happy
pankajgohel
Participant
1274 Points
289 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 01:16 PM|LINK
check your HTML structure by view page souce.
If there is structue is not proper than also it may take time to render.
Pankaj Gohel
Please Mark as Answer if you find the post useful.
dinoboy
Member
542 Points
105 Posts
Re: why my control is so slow on ie7 and normal on firefox ?
Sep 29, 2009 01:33 PM|LINK
Thanks for the tip :). This may very well be the reason to the problem I described previously, because in my case the site is pretty old and HTML is not quite valid and pages contain very large amount of html (many big tables mixed with other elements and script tags all over the page).
Sorry for the off topic...