Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vinay SinghRank #604 · 4K reputationPosted Aug 16, 2016, 8:49 PM EDT
When you add properties that don't exists in the TextBox class, asp.net will render those properties to the resulting html. So
Will render to something like this
type="text" value="bbbb" id="..." name="..." mycustomproperty="hi"/>If you omit the
TextBox'sTextproperty and write the value property, then the value property will be rendered.To
type="text" value="aaaa" id="..." name="..."/>TextBox doesn't has a Value property. When the TextBox instance is created, the HTML value property will be assigned to the Text property, and that's why you access the Text property it has the "aaaa" value.
Summary: Don't use value property when you use ASP.NET controls. Use the controls specific properties.
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 5, 2016, 5:53 AM EDT
Jisny AvRank #4,868 · 321 reputationPosted Aug 16, 2016, 8:33 PM EDT
Soumalya DasRank #2,515 · 558 reputationPosted Aug 16, 2016, 9:57 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Aug 16, 2016, 10:22 PM EDT