ASP Code
  Home arrow ASP Code arrow Free State Management ASP component by Bij...
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

Free State Management ASP component by Biju Francis
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2000-07-01

    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


    Free State Management ASP component

    Biju Francis sent ASPFree code that does not use any of the known methods of State management in ASP. What  it is using is a Component which maintains the of Controls and recordsets. This is a very handy component to experiment with!  Thanks Biju! 

    <%@ Language=VBScript %>
    <object id ='objContainer' progid='DataCom.DataContainer' runat='server'></object>
    <%
    'Create an Object of Component DataCom.DataContainer

    Dim rsData
    '----------------------------------------------------------------------------------

    'This If Condition Checks if the user is comning from some other page
    If trim(Request.QueryString("FromPage"))<>"" then
        'if the user comes from some other page back to this page
        'the values of the controls are retreived
        Set rsData=objContainer.GetControlValues (Session.SessionID ,"Page1Container")
        'Once the Values are Retreived the DataContainer is Killed
        objContainer.KillDataContainer Session.SessionID,"Page1Container"    
    End If

    '----------------------------------------------------------------------------------

    'This function takes one Parameter i.e. the ControlName and
    'returns a Value for that Control if it exist.
    'This Function is Called below where the Value for the textboxes are
    'e.g. value = fnControlValue("txtFirstName")

    Function fnControlValue(byval ctrlname)   
        if isobject(rsData) then       
            rsdata.Movefirst
            rsdata.find "ControlName like '" & ctrlname & "'"
            if rsdata.eof then
                fnControlValue = ""
            else
                if isnull(rsdata("ControlValue")) then
                    fnControlValue = ""
                else
                    fnControlValue = rsData("ControlValue")
                end if
            end if
        else
            fnControlValue = ""        
        end if
    End function

    '-----------------------------------------------------------------------------------

    Response.Write "<html>" _
                    & "<body>" _
                    & "<Form name ='Page1' method ='Post'>" _
                    & "<table border='0' cellpadding='0' width='75%'>" _
                    & "<tr>" _
                    & "<td colspan='2'><strong>Enter Details</strong></td>" _
                    & "</tr>" _
                    & "<tr>" _
                    & "<td>&nbsp;</td><td>&nbsp;</td>" _
                    & "</tr>" _
                    & "<tr>" _                
                    & "<td>First Name</td><td><input type='text' name='txtFirstName' value ='" & server.HTMLEncode(fnControlValue("txtFirstName")) & "'></td>" _
                    & "</tr>" _
                    & "<tr><td>Last Name</td><td><input type='text' name='txtLastName' value ='" & server.HTMLEncode(fnControlValue("txtLastName")) & "'></td>" _
                    & "</tr>" _
                    & "<tr><td>Title</td><td><input type='text' name='txtTitle' value ='" & server.HTMLEncode(fnControlValue("txtTitle")) & "'></td>" _
                    & "</tr>" _
                    & "<tr><td>Email Id</td><td><input type='text' name='txtEmail' value ='" & fnControlValue("txtEmail") & "'></td>" _
                    & "</tr>" _
                    & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>" _
                    & "<tr><td></td>" _
                    & "<td><input type = 'submit' name = 'cmdSubmit' Value = 'Go to Page2'></td>" _
                    & "</tr>" _
                    & "</table>" _
                    & "</body>" _
                    & "</html>"

    %>

    <SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
    <!--

    Sub cmdSubmit_OnClick
        Page1.action = "Page2.asp"
        Page1.submit
    End sub

    -->
    </SCRIPT>

    Page 2 of the sample

    <%@ language=VBScript %>
    <object id ='objContainer' progid='DataCom.DataContainer' runat='server'></object>
    <%
    'Create an Object of Component DataCom.DataContainer

        Dim rsData
       
        'This Method creates a Container to Store the Control Values
        set rsData = objContainer.CreateDataContainer
        'Loops through the Form Collection
        For each name in Request.Form
            rsData.AddNew
            rsData("ControlName") = name
            rsData("ControlValue") = Request.Form(name)    
        Next
        rsData.UpdateBatch
        'This Method set the Values of the Controls to the Data Container
        objContainer.SetControlValues session.sessionid,"Page1Container",rsData

        Response.Write "<a href='Page1.asp?FromPage=Page2'>Back to Page1</a>"
    %>

    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: The Integrated Project and Portfolio Management Platform.

    Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan.
    FREE! Go There Now!


    NEW! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! Develop Systems Software Assets with IBM Rational Asset Manager

    Join us for this on demand webcast to learn about developing complex systems more quickly and efficiently. We'll cover market drivers for developing, governing and reusing systems software assets and how you can develop system software assets with Rational Asset Manager.
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! Rational Build Forge Express eKit

    Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast.
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! Successful Change and Release Management for .NET

    Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    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 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek