How to modify style for an asp:textbox in codebehind ?
Posted
by Fahad
on Stack Overflow
See other posts from Stack Overflow
or by Fahad
Published on 2010-03-15T07:45:15Z
Indexed on
2010/03/15
7:49 UTC
Read the original article
Hit count: 395
Hi all, I am trying to set the style of an asp:TextBox in codebehind, the textbox is style is set initially to
style="display:none"
when I set the dispaly to block in codebehind the textbox appears for a moment and then it's gone. I don't know what this problem is, when it's done in javascript it works fine
Here is the code:
asp.net code:
<asp:TextBox ID="txtError" style="display:none" runat="server" ReadOnly="True" Width="95%"></asp:TextBox>
codebehind:
txtError.Style["display"] = "block";
Am I doing anything wrong? Thanks in advance.
© Stack Overflow or respective owner