RegisterStartupScriptBlock is not a member of System.Web.UI.Page

marlin

Newcomer
Joined
Apr 23, 2004
Messages
15
I tried to write client-script code in ASP.NET code behind (as shown in bold below) using Visual Studio.NET, but somehow it keeps on telling me that either RegisterClientScriptBlock or IsStartupScriptRegistered are not members of System.Web.UI.Page. Could anyone please help me with this?

Thank you.
==========================================================
Public Class LaborDistributionDownload
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents Form2 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents btnDownload As System.Web.UI.WebControls.Button
Protected WithEvents DIV1 As System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton
Protected WithEvents aDownloadNow As System.Web.UI.HtmlControls.HtmlAnchor

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim strStartupScript As String

strStartupScript = "<script language=JavaScript>"
strStartupScript = strStartupScript & "aDownloadNow.href='" & Session("strReportFolder") & "/" & Session("strFileName") & ""
strStartupScript = strStartupScript & "<" & "/" & "script>"

If (Not Page.IsStartupScriptBlockRegistered("scriptSetHref")) Then
Page.RegisterStartupScriptBlock("scriptSetHref", strStartupScript)
End If
End Sub

End Class
 
Back
Top