Search code examples
.netasp.nettextboxbackcolor

.NET TextBox BackColor issue


On a .NET page, I have a textbox. If I don't change the BackColor property, it looks flat. However, when using BackColor, e.g.:

txt.BackColor = System.Drawing.Color.Yellow;

the look changes to some sort of "3D" which I don't really like. Is it possible to avoid this effect?

first:

enter image description here

edited:

enter image description here


Solution

  • It seems backcolor influences the borderstyle-property? which makes no sense to me, but I can simulate the look of a "normal" textbox like this

    <asp:TextBox runat="server" ID="valueTxt" Enabled="false" BackColor="#E8E8E8" Width="50px" BorderStyle="NotSet" BorderWidth="1px" BorderColor="#B0B0B0"></asp:TextBox>