#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    South West UK
    Posts
    7
    Rep Power
    0

    View State Problems.


    I'm following the very simple samples in "ASP.NET UNLEASHED".

    And I have written the following code (in fact pasted direct from their site.

    <form runat="Server">
    <b>Username:</b>
    <br><input id="username" type="text" size="30" runat="Server">
    <p>
    <b>Comments:</b>
    <br><textarea id="comments" cols=60 rows=10 runat="Server"></textarea>
    <p>
    <input type="submit" value="Add Comment" runat="Server">
    </form>
    </body>
    </html>


    Accordign to the book ASP.NET uses "view state" to rememeber what was in the field previously. The book says that this form should therefore keep the data in the fields after I submit but when I try it it deletes the content.

    Any ideas why? Is there some setting within IIS that I need to change?

    help me please!!!!!!!

    I wish I could use PHP and Apache :-(
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    SC
    Posts
    26
    Rep Power
    0

    Lightbulb Believe me, when you finally get it, you'll love ASP.NET.


    You are correct that the viewstate is default. What is in your codebehind page?

    I pasted your code directly into a NEW webform, and my viewstate was there. Here is the entire page code, look at it compared to yours:


    ========================================
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="AcroWebInterface.WebForm1"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</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>
    <form id="Form1" method="post" runat="server">
    <b>Username:</b>
    <br>
    <input id="username" type="text" size="30" runat="Server" NAME="username">
    <p>
    <b>Comments:</b>
    <br>
    <textarea id="comments" cols="60" rows="10" runat="Server" NAME="comments"></textarea>
    <p>
    <input type="submit" value="Add Comment" runat="Server" ID="Submit1" NAME="Submit1">

    </form>
    </P>
    </body>
    </HTML>
    ========================================

    Hope it helps!

IMN logo majestic logo threadwatch logo seochat tools logo