Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 21st, 2006, 04:03 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with clientscriptmanager

hi guy,
I want to create a popup window in my asp application & be able to pass parameters to that new window. I've found some code on another message board which should do the trick, except i'm having problems compiling it.

    Private Sub PopupForm()
        Dim nWindow As String = "NewWindowScript"
        Dim cstype As Type = Me.GetType()

        Dim csm As ClientScriptManager = Page.ClientScript

        ' Check to see if this script is already registered.
        If (Not csm.IsClientScriptBlockRegistered(cstype, nWindow)) Then

            Dim scriptText As New StringBuilder
            scriptText.Append("<script type=text/javascript> function OpenNewWindow(nw,param) {")
            scriptText.Append("window.open(nw+param,null,'heig ht=450,width=450,status=no,")
            scriptText.Append("resizable=yes,scrollbars=no,too lbar=yes,location=yes,menubar=no');}")
            scriptText.Append("</script>")
            csm.RegisterClientScriptBlock(cstype, nWindow, scriptText.ToString(), False)

        End If
        'declare two variables (you can get this information elsewhere though)
        Dim pageName, param As String
        pageName = "default.aspx?ID="
        param = "SomeIdValue"
        'add an attribute to your label (or other control) and pass
        'in the pagename and a value. These are then accepted
        'in the function we previously decalred (added to the page) and
        'used to open a new window with parameters.
        lblCheckAttribute.Attributes.Add("onclick", "OpenNewWindow('" & pageName & "','" & param & "');")
    End Sub

---------------------------------------------------------
The error message it gives is : "Type 'ClientScriptManager' is not defined."

I've tried using the import statement "imports system.web.ui", but it still gives me the error. Can anyone please help me out?

thanks,
mark



 
Old November 21st, 2006, 05:53 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Sounds like you are trying to do 2.0 stuff on the 1.1 Framework O.o

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.