views:

132

answers:

2

Hi all,

I'm working on a long, dynamic form (100 or so fields) and am using toolkit items such as CalendarBehaviors, HovermenuBehavior, etc for each field.

I've never worked with that many toolkit items at once, and am seeing a big performance hit in rendering. Every instance of a toolkit control is being sent to the client in its' own <SCRIPT></SCRIPT> tags. In other words, 200 instances of he following:

<SCRIPT type="text/javascript"> 
Sys.Application.add_init(function() {    $create(AjaxControlToolkit.HoverMenuBehavior, {"OffsetX":20,"PopDelay":50,"dynamicServicePath":"/default.aspx","id":"hmePopupHelpPolicyNumber","popupElement":$get("lblHelpPolicyNumber")}, null, null, $get("imgHelpPolicyNumber"));});
</SCRIPT>
<SCRIPT type="text/javascript"> 
...snip
</SCRIPT>

Is there any way to control this and have all the controls created in a single script block?

Also, does anybody know of a good, detailed article that would describe how IE 7 parses and renders html and javascript?

And I know most of you will recommend JQuery instead. Unfortunately that is not an option in this project.

Thanks in advance and happy coding.

+1  A: 

I'd say rethink your design of the page. That many items on your page can't make for a good user experience. Instead of coding a really far out solution, reconsider your design and it will probably benefit your user in the end as well.

Edit: Your question is at the heart of what many consider the major drawback to using WebForms. There is little control on how the server renders the controls and emits their HTML. Without a more "advanced" approach which you are trying to avoid, I'd be hard pressed to suggest anything other than breaking the form up into smaller pieces. If it is a data entry form, it may be faster for the user to type in the date fields as opposed to populating the form via mouse clicks.

Achilles
A: 

Going along the lines of @Achilles' answer, I would break up the form into multiple pages. You could also try one page with multiple tabs.

Update: Something else that might help you is the ToolkitScriptManager. It combines all of the external toolkit scripts into one single external script. I think it also combines all of the inline toolkit scripts into one block.

jrummell
Frank
Take a look at my edit for a different spin on my response.
Achilles
Thanks Achilles. The users can tab between fields and enter without the mouse (I have the calendar controls attached to textboxes, etc.) Once the form loads, entry is very fast. The problem is each field requires pop up help, validation, etc. I looked into the usability of having a wizard type control (3 steps) or tabs, but 3 steps at 2 secs vs 6 secs for a single page... not much difference. I did have an MVC prototype that had great performance, but MVC is too much of a step for my team lead.So I guess I'm stuck with this model. I'm just trying to do everything possible to optimize it.
Frank
I added an update about the ToolkitScriptManager, but I don't think you'll get a decent response time unless you're able to break it up into smaller pieces. I would say 2 secs for each step is better than 6 for the whole form, but that's just me ...
jrummell
Thanks JRummel, that looks very helpful. Don't know how I missed that:) I'm also using localization, so the page you linked on the Toolkit site was helpful in a few ways. I guess I've accepted the fact that this is the only solution that will satisfy my bosses. I just want to get every last bit of performance that I can out of this.
Frank
Glad I could help!
jrummell