views:

147

answers:

2

I want to be able to find the old value of a asp.net control (textbox, checkbox etc) without relying on events (e.g. OnTextChange event). Something like "someTextboxControl.OldText" would be perfect! I imagine that it is stored in the viewstate and need to somehow get at it via a custom control. Any ideas?

A: 

you could iterate Request.Form collection ffor details how you can iterate this check this link http://msdn.microsoft.com/en-us/library/ms525985.aspx

Muhammad Akhtar
Wouldn't that give the current values that were posted back in the form fields rather than the values that was sent to the client before they were updated?My goal is to figure out what fields have been updated on postback but not using events and not querying the database a second time.
D3no
A: 
public class TextBoxEx:System.Web.UI.WebControls.TextBox
    {
        public string OldText { get; set; }


        protected override bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
        {
            OldText = Text;
            return base.LoadPostData(postDataKey, postCollection);
        }

    }
Shrage Smilowitz