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! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Did you say mainframe? e-kit

    Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise.
    FREE! Go There Now!


    NEW! Evaluate IBM Lotus Sametime Standard V8.0

    Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration.
    FREE! Go There Now!


    NEW! Evaluate Rational Business Developer V7.1

    Visit IBM developerWorks to download a free trial version of IBM Rational Business Developer V7.1. Rational Business Developer offers rapid and simplified development of business applications and services through Enterprise Generation Language (EGL) tools, generating Java or mainframe solutions while shielding developers from technical complexities.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Method Composer V7.2

    Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Performance Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!


    NEW! Webcast: Extreme transaction processing with WebSphere Extended Deployment

    In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications.
    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...
    - Various methods of setting Date values to a ...
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT