View Full Version : VS 2008 Express "dynamic" page only half rendering - Causing Javascript error
hkdave95
09-16-2007, 01:03 AM
Hi
NB: Using 3rd party Telerik controls (I don't think this problem is related to them though - hence posting on this forum instead of theirs)
When I click a button on my form a server side postback occurs.
During this postback several ScriptManager.RegisterClientScriptBlock's occur.
After the postback and the page refreshes I get a generic Javascript error (Object required) and when the program goes into debug mode the RegisterClientScriptBlock (from the codebehind) javascript appears and then the page gets "cut" off.
It just so happens that the ScriptManager.RegisterClientScriptBlock inserts call functions on the lower half of the page. Since it is not being rendered the javascript error occurs.
NB: I have attached an example of the half rendered page for you to look at.
Any ideas ?
Kind Regards
David
nikkiH
09-17-2007, 03:56 PM
Please post the server-side code that is writing the script. That call to register client side script block.
hkdave95
09-17-2007, 04:39 PM
Hi nikkiH
Thanks for taking up thae call.
Will post necessary code once back home. Approx 3.5 hours.
nikkiH
09-17-2007, 07:36 PM
No problem.
First thing to check is mismatched quotes. It's the biggest gotcha.
hkdave95
09-17-2007, 08:14 PM
This is the Code that Registers the Client Script Block
Public Overridable Sub ExecuteJavascript(ByVal loPage As Page, ByVal lsScript As String)
Call ScriptManager.RegisterClientScriptBlock(loPage, loPage.GetType, "ExecuteJavascript" & Me.pnJavaScriptCount.ToString("00000"), lsScript & vbCrLf, True)
Me.pnJavaScriptCount += 1
End Sub
... And this is some of the code that calls the Execute Javascript function
Call Me.GU.ExecuteJavascript(Me.Page, "funRefreshFooter('pages/DareFooter.aspx');")
Hope this provides a better idea of what is going on ...
ALso I have tried without the vbCrLf and have the same problem.
Kind Regards
David
nikkiH
09-17-2007, 10:05 PM
What is being passed here?
lsScript
nikkiH
09-17-2007, 10:07 PM
I see an opening script tag in that half rendered page.
Are you trying to write the text
<script>
or </script> in there anywhere?
If so, you need to split it. It's a known issue.
You have to do like "<" & "/script>"
hkdave95
09-18-2007, 08:30 AM
Hi nikkiH
Yes I know about that issue.
However the last paremeter on the ScriptManager.RegisterClientScriptBlock is set to "True" and that means the ScriptManager writes the tags for you.
I will try setting to false and writing the tags for myself in case Microsoft have forgotton about the "<" & "/script" issue themselves.
The JAvaScript that I am passing to the ExecuteJavascript function is in the 2nd code post in my previous post.
Kind Regards
David
hkdave95
09-18-2007, 08:50 AM
Hi
This is my revised code.
Public Overridable Sub ExecuteJavascript(ByVal loPage As Page, ByVal lsScript As String)
lsScript = "<script language=""JavaScript"" type=""text/javascript"">" & vbCrLf & lsScript & vbCrLf & "<" & "/script>"
Call ScriptManager.RegisterClientScriptBlock(loPage, loPage.GetType, "ExecuteJavascript" & Me.pnJavaScriptCount.ToString("00000"), lsScript & vbCrLf, False)
Me.pnJavaScriptCount += 1
End Sub
It also fails in the same way. Only showing the "<" of the end tag.
Hmmmm. Not sure what is happening here at all.
Kind Regards
David
nikkiH
09-18-2007, 03:26 PM
This is the last item written in the file:
funRefreshSlidingZone('pages/DareSOFTLogin.aspx', 'rpDefaultLoginDS');
What component should have been rendered after that?
Did you try tracing with the VS debugger, if you have it? Do you have On Error Resume Next anywhere in your code?
hkdave95
09-19-2007, 08:43 AM
Hi
I am not abosultely sure.
It is possible that Micorsoft have not taken into account the "<" & "/script>" workaround.
And therefore the page always seems to fail on a "<".
Sorry for not being anymore help but I am a bit stuck with this one.
Anybody else out there who has seen this behaviour before ?
Kind Regards
David
hkdave95
09-19-2007, 08:51 AM
Hi
This seems to be a related post http://forums.asp.net/t/1057764.aspx
nikkiH
09-19-2007, 03:19 PM
It IS possible, which is why you should try to trace in the debugger to see what is being rendered when. You use Express, which may have a bug in one of the components.
hkdave95
09-24-2007, 08:36 AM
Hi
Thanks for all your help nikkiH.
I have decided to scrap VS 2008 Framework 3.5 for the time being and use the tried and tested VS 2005 Framework 2.0.
So far not exibiting the above behaviour.
Kind Regards
David
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.