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
There is no built in way of retrieving the default value of a textbox during postback.
One option would be to use ViewState to store the value during the initial PageLoad and retrieving it from there during the postback to make the comparison.