Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 October 25th, 2005, 10:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Page Variables or Properties

I have some Page variables that I need to save across postbacks. I am wondering what are the pros and cons of using a page variable like:
Code:
Public sortDir As String
or a Page Property like:
Code:
' Holds the direction to be sorted...
    Public Property sortDir() As String
        Get
            Return CStr(viewstate("sortDir"))
        End Get
        Set(ByVal Value As String)
            ViewState("sortDir") = Value
        End Set
    End Property


The viewstate I know goes across the wire to the user as a hidden element on the page, and therefore affects page size, but are there other tradeoffs to consider? Then there's also the option of using a Session variable...

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
 
Old October 25th, 2005, 02:08 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

The page variable will be reset each time the page is posted back. As for the propery issue, I never used it but looks like it should work. I usually just use session variables. That is if you don't have many you need to store.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer Page Setup Properties JpJoe Excel VBA 0 January 12th, 2006 11:04 AM
How to pass variables from Aspx page to Asp Page jayaraj Classic ASP Basics 2 May 23rd, 2004 06:56 AM
How to pass the variables in Aspx page to Asp Page jayaraj ASP.NET 1.0 and 1.1 Basics 3 May 23rd, 2004 06:55 AM





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