Results 1 to 2 of 2

Thread: how viewstate is working here in my code?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Location
    india
    Posts
    95

    how viewstate is working here in my code?

    hi,

    in my page im making the enableviewstate=false as shown below. Still im getting viewstate hidden control
    in my view source.

    if i add textbox with viewstate false then also im getting data from vb code behind.

    how this happens? what is the processing? how im getting the textbox value in vb code?


    ASPX Page Content
    -----------------

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestViewState.aspx.vb" Inherits="Transact.sample.Player.TestViewState" enableViewState="False"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>TestViewState</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    </form>
    </body>
    </html>


    Viewsource Content
    ------------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>TestViewState</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body MS_POSITIONING="GridLayout">

    <form name="Form1" method="post" action="TestViewState.aspx" id="Form1">
    <input type="hidden" name="__VIEWSTATE" value="dDwtMTI3OTMzNDM4NDs7PpEcasDXfAJGUQQ/3/XtjHSKxDhk" />
    </form>
    </body>

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how viewstate is working here in my code?

    You need to override a couple of methods.

    VB Code:
    1. Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As Object)
    2.  
    3.  
    4.  
    5.     End Sub
    6.  
    7.     Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
    8.         Return Nothing
    9.  
    10.     End Function
    11.  
    12.     Protected Overrides Function SaveViewState() As Object
    13.  
    14.         Return Nothing
    15.  
    16.     End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width