Text field creation not editable

work on C # asp.net vs 05. I have a requirement, I need to fill in the text box with some data about the gridview that comes from the database and makes it read-only

After that, the user cannot enter any text into the gridview template field. If I set the text box Enabled=false, I lose the color of the text, but I want to show the color of the text. Just the text box is not editable. I just want users to not be able to write anything in their text box.

+3
source share
7 answers

Are there readonly properties in the text box.

If you can use

ReadOnly = "true"

for the text box.

, , .

word-wrap

word-wrap: break-word

.

CssClass.

CssClass "TextStyle"

css :

.TextStyle
{
    color: #a9a9a9
}

color , "", "# 000000" .

+9

Enabled = ""

+4

CSS TextBox GridView.

0

CSS, .

0

, .

<head runat="server">
    <style>
    .readTest 
    {
        border: none;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox runat="server" Text="Do something" ReadOnly="true" 
       ID="txtOne" CssClass="readTest"></asp:TextBox>
    </div>
    </form>
</body>
</html>

, , , .

0

asp: label ? , <span>, AssociatedControlId?

asp: Panel , , asp: Literal asp: PlaceHolder, .

, <div>, PlaceHolder Literal, .

, , , <div> , inline (<span>).

0

, () , . ViewState, . , ViewState .

0

Source: https://habr.com/ru/post/1718273/


All Articles