• 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-501450.flv
0
Tom Knowlton
Asked:
Tom Knowlton
  • 2
2 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
set the Enabled property to False
0
 
BlueYonderCommented:
Try the enabled tag.  Here is an example.
<asp:TextBox runat="server" ID="txtSomething" CssClass="textEntry" Enabled="false"></asp:TextBox>
0
 
Tom KnowltonWeb developerAuthor Commented:
If I do that, do I still need to bother with ReadOnly?
0
 
BlueYonderCommented:
Readonly is not required when enabled is set to false
0
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