Previously I managed to create a code that can open a new aspx page with a click of a button in VB.Net 2010.
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Dim a = "UpdateForm.aspx"
Dim openWin As String = "window.open('" & a & "');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", openWin, True)
End Sub
Now I want to use the same code on VB.Net 2003 but for some reason I got hit with the error
Name 'ClientScript' is not declared.
Is this because of the difference between 2003 and 2010? Are they any workarounds for this?
You should try to add
Pageinstance before usingClientScript:Note that
ClientScriptproperty is a property defined insidePageclass, hence you should includePageinstance to access it.Note:
For ASP.NET 1.1 (and VB.NET 2003) just use
Page.RegisterStartupScriptas follows:Also you need to add opening and closing script tags because deprecated
Page.RegisterStartupScriptmethod doesn't haveaddScriptTagsparameter which automatically add script tag if it set asTrue.Related issues:
Name 'ClientScript' is not declared
Clientscript.RegisterStartupScript not working