PC Review


Reply
Thread Tools Rate Thread

Asp.Net 2.0 - Textbox previous value

 
 
Steve
Guest
Posts: n/a
 
      9th Jan 2008
How do I get the previous value of a text box ? Is there a way to access
the TextBox control state ?

Thanks for any direction,
Steve

 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      9th Jan 2008
"Steve" <(E-Mail Removed)> wrote in message
news:0929C6C6-FFD8-4EE2-B6A6-(E-Mail Removed)...

> How do I get the previous value of a text box ? Is there a way to access
> the TextBox control state ?


There are some clever tricks you can do with ViewState, but by far the
simplest (and 100% guaranteed) method is to include a hidden field
containing the initial value of the textbox and then compare the two at
postback:

<asp:TextBox ID="MyTextBox" runat="server" Text="Hello" />
<asp:HiddenField ID="MyHiddenTextBox" runat="server" Value="Hello" />


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Hal Rosser
Guest
Posts: n/a
 
      10th Jan 2008

"Steve" <(E-Mail Removed)> wrote in message
news:0929C6C6-FFD8-4EE2-B6A6-(E-Mail Removed)...
> How do I get the previous value of a text box ? Is there a way to access
> the TextBox control state ?
>
> Thanks for any direction,
> Steve


This video talks some about postback
http://msdn2.microsoft.com/en-us/beginner/bb308809.aspx


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide and move up a textbox based on previous textbox moosecck@gmail.com Microsoft Access Reports 2 28th Oct 2008 11:08 AM
Get TextBox previous value on Postback Mort Strom Microsoft ASP .NET 0 9th Jan 2008 05:58 PM
Textbox 'remembering' previous entries almurph@altavista.com Microsoft VB .NET 3 6th Apr 2006 09:29 AM
Updating a textbox without erasing previous data nadir Microsoft Excel Programming 1 2nd Dec 2003 10:27 PM
Enter Day in textbox based on day input in previous textbox Sue M Microsoft Access Forms 1 8th Aug 2003 10:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:23 AM.