ASP Code
  Home arrow ASP Code arrow Popup Window Example by Dario Medele
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

Popup Window Example by Dario Medele
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2001-05-18

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Pop up window

    This example illustrates how to narrow down a search. The code below shows how to pop up a window that will get records and typing into the textbox will narrow down the selection. The actual demo will also pass a parameter to the pop-up window and has the option to keep the window open in case the form is accessed often. Simply view the code source for a complete reference of all the functionality.

    To view the demos please follow this link. http://www.houndware.com/dario/pop.asp

    Click on the search icon to open up a new window and type the parameter into the textbox.

     

    This function opens a pop-up window
    <%
    'opening a recordset and dumping it into an array
    'I assume you already know how to establish a connection

    rs.Open strsql, strconn,adOpenStatic, adLockReadOnly, adCmdText
    arData = rsWO.GetRows()
    numCols= ubound(arData , 1 )
    numRows= ubound( arData , 2)
    %>

    Also create a textbox and call it LastName. You can alternatively
    pass the name of the textbox as a parameter to the javascript
    function PopWin() as an option and your code will be more reusable

    This is the ASP page

    <%
    'opening a recordset and dumping it into an array
    'I assume you already know how to establish a connection

    rs.Open strsql, strconn,adOpenStatic, adLockReadOnly, adCmdText
    arData = rsWO.GetRows()
    numCols= ubound(arData , 1 )
    numRows= ubound( arData , 2)
    %>
    .......................................
    <%Script language=javascript %>
    // building the array
    var arData = new Array();
    var numRows = '<%=numRows + 1 %>';
    var numCols = '<%=numCols%>';
    <%
    for I=0 to numRows
    response.write ( "arData[" & I & "] = new Array();" & vbcrlf )
    for J=0 to numCols
    response.write ( "arData[" & I & "][" & J & "]= """ & arData(J,I) & """;" & vbcrlf )
    next
    next
    end if %>
    function sendBack(vValue)
    {
    window.opener.LastName.value = vValue;
    }
    function fillData()
    {
    var a= "";
    var b="";
    var varData = "" ;
    var intLength = document.all.test.value.length ;
    varData = "< table width=100% cellspacing=0 > < tr > < td > < font color=white > Last Name < /td > < td > < font color=white > First Name < /font> < /td > < /tr >";
    for (var r=0 ; r < numRows ; r++ )
    {
    for (var c=0 ; c < numCols ; c++)
    {
    a= arData[r][0].substr(0,intLength);
    b= document.all.test.value;
    if ( a.toLowerCase() == b.toLowerCase() )
    {
    varData = varData + " < TR bgcolor=silver > < TD >< a href=javascript:sendback( " " + arData[r][0] + "')> " + arData[r][0] + "< /a > </TD > < td > " + arData[r][1] + " </td > </TR > " ;
    }
    } }
    varData= varData + " </table> "
    DataTran.innerHTML = varData ; // varData contains all the new data is set using innerHTML
    }

    And the last step is to add a div tag in you code.
    Just like this:
    < div id="Detail">
    < p ID="DataTran"> </p>
    < /div>



    And that should do it. Again view the source of this page to see more functionality added to the script I hope this helps or give you new ideas on how to - or not to :) - search for specific records.
    Dario Medele

     


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! IBM Rational AppScan Standard Edition V7.7

    Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7.
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 2: Automate builds for a real-world Tomcat project

    Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available.
    FREE! Go There Now!


    NEW! Innovate don't duplicate! Asset reuse strategies for success

    Asset Reuse is a key strategy for companies looking to create innovative solutions to solve complex software development problems. Searching for, identifying, updating, using and deploying software assets can be a difficult challenge. Listen to this webcast, to learn about strategies and tools that you can leverage for a successful project, including Rational Asset Manager, Rational Software Architect and WebSphere Service Registry and Repository.
    FREE! Go There Now!


    NEW! Rational Asset Manager eKit

    Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions.
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered!
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Webcast: Quickly provide customized, integrated user interfaces with Lotus Notes 8

    IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...
    - Format Date/Time in a console app class





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek