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
2010-02-09 04:35:27
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
2010-02-17 14:28:41
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
2010-05-14 03:04:07