TextBox property value not saved

In asp.net 3.5, I'm using the textbox below and assign it values on Page_Load.  After assigning values in Page_Load, I see the values are still there on OnPreRender.  The textBoxes dictionary is of type:

Dictionary<SymbolId, PriceHistoryTextBox>

where SymbolId is an enum.  The dictionary contains all of the textboxes on the form.  When I do a postback via button_click, PriceHistoryId is always zero for every textbox.  EnableViewState="true".  Where did the value go?
[DefaultValue(0)]
    public class PriceHistoryTextBox : TextBox
    {
        private int _priceHistoryId = 0;
 
        public int PriceHistoryId { 
            get
            {
                return _priceHistoryId;
            }
            set
            {
                _priceHistoryId = value;
            }
        }
    }
 
//assigned on Page_Load
private void assignTextboxes(List<History> histories)
        {
            resetTextBoxes();
            foreach (History h in histories)
            {
                PriceHistoryTextBox box = textBoxes[(SymbolId)h.SymbolId];
                if (box != null)
                {
                    box.Text = h.ClosingPrice.ToString();
                    box.PriceHistoryId = h.Id;
                }
            }
        }

Open in new window

brettrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David RobitailleAnalyst ProgrammerCommented:
you have to save you textBoxes dictionary is in the session in order to retirve it on post back.
object on the page are "scraped" at each post back.
 
 
 
 
0
David RobitailleAnalyst ProgrammerCommented:
i just find i was in the wrong way, my apologies.
For what i understand, you have to manipulate the viewstate, it s not automatic like for serialization
http://www.developer.com/net/asp/article.php/3606741
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brettrAuthor Commented:
You're absolutely right.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.