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 April 10th, 2006, 06:57 AM
Authorized User
Join Date: Jan 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default using javaScript in the code behind

  please could any one tell how to open a popup using javascript in the code behind of an asp.net application..... and also pass some parameters in the url ie.
window.open("xyz.aspx?a="+value1+"&b="+value2,"",f eatures) ..this is
fine in the client side code but how can i use it in the code behind.. thank you

Old April 10th, 2006, 03:19 PM
Authorized User
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts

I was workin on a similar kind of issue some time ago, I used Page.RegisterStartupScript method.
I had to produce a pop up window with a chart and related data based on several listbox selections on the click of a button. Following is a VB.NET code that I wrote to achieve what I just explained. Hope this is what you are looking for.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strPop As String
        Dim file As String
        file = "chartmaker.aspx?chType=" & lst_ChType.SelectedValue & "&Table=" & lst_Table.SelectedValue & "&Values=" & lst_Values.SelectedValue & "&Categories=" & _
                lst_Categories.SelectedValue & "&Series=" & lst_Series.SelectedValue

        strPop = "<script language='javascript'>" & vbCrLf _
                & "window.open('" & file & "','Report','menubar=1,status=1,scrollbars=1,resiz able=1')" & vbCrLf _
                & "</script>" & vbCrLf
        Page.RegisterStartupScript("Pop", strPop)

    End Sub
Sai Puli

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript code popuri_krishna Javascript How-To 0 May 23rd, 2007 11:58 PM
problems with JavaScript Code red_fiesta Javascript 5 March 6th, 2007 04:44 PM
calling javascript as well as codebehind code k.manisha C# 1 November 27th, 2006 08:47 AM
javascript as well as codebehind code k.manisha .NET Framework 1.x 0 November 24th, 2006 04:23 AM
JavaScript Code problem Ben Horne Javascript 5 February 11th, 2006 02:10 AM

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