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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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!


    IBM – Taking Web 2.0 to Work

    You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Applying lean thinking to the governance of software development

    Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations.
    FREE! Go There Now!


    NEW! Download DB2 Express-C 9.5

    Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    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! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    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! Webcast: Accelerating Software Innovation with System z

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Webcast: Eclipse: Empowering the universal platform

    The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now.
    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-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway