I have been spying the MSDN and can't see a property/method for TextBox that allows you to get the default text value that was set on a field; I want to be able to compare the current txtMyTextBox.Text to the default value (like this psuedo code shows):
var myValue = (String.Compare(txtMyTextBox.Text, txtMyTextBox.DefaultText) ? "" : txtMyTextBox.Text)
Is this something which exists in the ASP.NET control? Or am I asking too much? :)
Thanks for any help (as always)!
Pete
By DefaultText do you mean the initial text before editing?
Perhaps declare this in a constant / field / etc somewhere, and set it programatically rather than in the markup - i.e. in the first load, txtMyTextBox.Text = defaultText; - then later you can just compare again to defaultText to track changes.
There is no "DefaultText" property on a textbox (or any other control). You probably have defined the default through a constant string, so just compare the Text property to that constant string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With