Hi, I get a client script error "type is null or not an object" when
using the following code. Basically I have an aspx page within a
frame that redirects to a PDF when a button is clicked. My actual
code is a lot more complex, but the following accurately reproduces
the problem. Note that if I access webform2.aspx by itself, or if I
remove the ScriptManager, I get no errors. It's only when I access
webform2.aspx from within menuframe.htm and use the ScriptManger do I
get the error. It seems there's a conflict between the ScriptManager
and the use of frames.
Can anyone help? Thanks.
menuframe.htm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link href="styles.css" type="text/css" rel="STYLESHEET">
</head>
<frameset cols="*" id="frameset1">
<frame name="contents" src='webform2.aspx' scrolling='auto'
frameborder='1' bordercolor='blue'>
<noframes>
<p id="p1">
This HTML frameset displays multiple Web pages. To view this
frameset, use a Web
browser that supports HTML 4.0 and later.
</p>
</noframes>
</frameset>
</html>
webform2.aspx:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="WebForm2.aspx.vb" Inherits="TE.WebForm2"
MaintainScrollPositionOnPostback="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>
webform2.aspx.vb:
Partial Public Class WebForm2
Inherits System.Web.UI.Page
Private m_cbchecked As Boolean = False
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub
Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)
If m_cbchecked Then
Response.Redirect("showreport.pdf", True)
Return
Else
MyBase.Render(writer)
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles Button1.Click
m_cbchecked = True
End Sub
End Class