ASP.NET TextBox Control - get text default value in code?

I spied on MSDN and do not see the property / method for the TextBox, which allows you to get the default text value that was set in the field; I want to compare the current txtMyTextBox.Text with the default value (for example, this shows the psuedo code):

var myValue = (String.Compare(txtMyTextBox.Text, txtMyTextBox.DefaultText) ? "" : txtMyTextBox.Text)

Is this something that exists in an ASP.NET control? Or am I asking too much? :)

Thanks for any help (as always)!

Pete

+3
source share
7 answers

There is no built-in way to get the default value for a text field during postback.

ViewState PageLoad .

+1

Text ?

, //etc - , , , txtMyTextBox.Text = defaultText; - defaultText, .

+3

( ) DefaultText. , , Text .

+2

, , Text. , . - textbox.Text.

+1

viewstate.

+1

TextBox .Text, " " - , , text textbox . " " cookie ( ), ViewState , .

+1

TextBox DefaultText, . ? i.e.

<asp:TextBox ...>Default Value</asp:TextBox>

.Text.

0

Source: https://habr.com/ru/post/1703172/


All Articles