Results 1 to 3 of 3

Thread: how do I get the EnableViewState to work?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    how do I get the EnableViewState to work?

    I have a textbox and I've set the EnableViewState property of it to false in the designer.....doesnt this mean that the value of the textbox should be reset each time I click the submit button?


    btw this is the first time I'm worknig with asp
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    heh, one would think so... i thought so too, but i just made up a little page, and i can see that's not the case.... very puzzling, that is....

    anyways, if you need to get rid of the text, you can simply put something in the Page_Load Event... like:

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Response.Write(TextBox1.Text)
    3.         TextBox1.Text = ""
    4.     End Sub

    That would take you to whatever you need to do when you click the submit button or whatever, then after it's finished using the TextBox Value, it'll set it to nothing, so that when the page displays again, the textbox is empty...

    I'm quite puzzled by this... i tried even setting the viewstate to disabled in the <%@Page %> directive, but it still came up everytime... very strange, but if it just won't work out for you, that sort of code should work just fine.

  3. #3
    Addicted Member
    Join Date
    Apr 2002
    Posts
    235
    Well, here's an article that sort of explains what's going on, but when I changed the background color of a textbox, it still persisted each postback. A list of which properties are and are not persisted would be helpful.

    Actually, I was wrong about the textbox color persisting. It doesn't persist if you set it as shown in the article. (I had set it in the html.)
    Last edited by csnyder; Mar 20th, 2003 at 11:23 PM.

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