Jump to content
Xtreme .Net Talk

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


Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...