• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1462
  • Last Modified:

Make textbox "not selectable"

I have some code in place to make a textbox look more like a label (sort of a "read only" status, of sorts).

 tbFirstName.BorderWidth = 0;
 tbFirstName.ReadOnly = true;

But, I can still put an insertion point next to the text.

See my screencast.  Notice around time index :34 seconds, I click next tot he W and it seems to put an  insertion point next to the W  (   W  |    ) but of course you cannot change the W by typing or anything, it still looks odd.

Thank you,

Tom Knowlton
Tom Knowlton
  • 2
2 Solutions
Éric MoreauSenior .Net ConsultantCommented:
set the Enabled property to False
Try the enabled tag.  Here is an example.
<asp:TextBox runat="server" ID="txtSomething" CssClass="textEntry" Enabled="false"></asp:TextBox>
Tom KnowltonWeb developerAuthor Commented:
If I do that, do I still need to bother with ReadOnly?
Readonly is not required when enabled is set to false
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now