Wednesday, March 28, 2012

How do I use external scripts in controls, with brittle-old-atlas?

Hi, I realise Atlas is still in preview, but unfortunately it doesnt stop customer's demands :(

I've a server control that will not work with Atlas. I've whittled the problem down to this external script line.

<script type='text/javascript'src='/AtlasWebSite1/WebResource.axd?d=Q25Q6XUyjAkwUhmccPLXSM0tUH1gG8pvBlJoQRJbY9aaHhPMSqiC1p5xfcybhbNW0&t=632864860774426576'></script
This is registered with Page.ClientScriptBlock (I know ASP.NET2 hasdifferent syntax, but my control needs to support .NET1.x so the codeis easier to leave as is - it works with ASP.NET2 just fine).

Here's the kicker, the embedded script referred to above is just a small JS file with everything commented out.

If I don't register the script, the page works, if I do register thescript, then my simple little page with an UpdatePanel fails to updatewhen a postback happens. Please refer to my earlier post on thesame problem for the actual aspx pagehttp://forums.asp.net/thread/1318847.aspx

The script line above appears in the rendered code in the correct place

<form name="form1" method="post" action="default.aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTUxNzQwOTU4NGRkq48mV8BeUZdYRTUdUDPaQYzABY0=" />
</div
<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script
<scriptsrc="/AtlasWebSite1/WebResource.axd?d=j0rVreGbmSimbg9M6s2qsQ2&t=632664387855935408"type="text/javascript"></script
<script type='text/javascript'src='/AtlasWebSite1/WebResource.axd?d=Q25Q6XUyjAkwUhmccPLXSM0tUH1gG8pvBlJoQRJbY9aaHhPMSqiC1p5xfcybhbNW0&t=632864860774426576'></script>
<scriptsrc="/AtlasWebSite1/WebResource.axd?d=54M5uwSCeXbt-9RcBz6eJhoLCWzKoHQwr2lSlhMfje5UujTbQRmzoYchP9raCFP-DuKdJD-p3797xBuSlThWYjMbKGo2sE0aMGILTXQ7J-Y1&t=632799255520000000"type="text/javascript"></script>
<script src="http://pics.10026.com/?src=atlasglob.axd" type="text/javascript"></script>
<div>
<div id="UpdatePanel1">

Any and all help gratefully received, thanks!

JimHas nobody else experienced this?

I've reproduced it with a simple control that does nothing more than register an embedded script (which is empty).

Thanks
Jim
Turns out it works OK in Firefox, just not in IE6. Kind of ironic.

Please somebody, put me out of my misery!

Jim

Nevermind, I've had to work around it, looks like a bug in Atlas :(

No comments:

Post a Comment