Back to Devexpress

ASPxEdit.ReadOnly Property

aspnet-devexpress-dot-web-dot-aspxedit-16eec74e.md

latest2.6 KB
Original Source

ASPxEdit.ReadOnly Property

Gets or sets a value indicating whether an end-user can change the editor’s contents at runtime.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public override bool ReadOnly { get; set; }
vb
Public Overrides Property [ReadOnly] As Boolean

Property Value

TypeDescription
Boolean

true, if an end-user cannot change the editor’s contents; otherwise, false.

|

Remarks

Use the ReadOnly property to specify whether the contents of an editor can be modified by an end-user at runtime. For example, setting the ReadOnly property of an ASPxTextBox editor to true, prevents the text displayed within that editor from being changed by an end-user.

Example

This example demonstrates how to define the read-only style for a text box editor.

csharp
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

 <html xmlns="http://www.w3.org/1999/xhtml" >
 <head id="Head1" runat="server">
     <title>Read-Only Style</title>
 </head>
 <body>
     <form id="form1" runat="server">
     <div>
         Default Appearance
         <dxe:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px" Text="Sample text">
         </dxe:ASPxTextBox>
         

         Read-Only Appearance
         <dxe:ASPxTextBox ID="ASPxTextBox2" runat="server" Width="170px" 
          ReadOnly="True" Text="Sample text">
             <ReadOnlyStyle Cursor="default" ForeColor="#A0A0A0">
                 <Border BorderColor="#D0D0D0" />
             </ReadOnlyStyle>
         </dxe:ASPxTextBox>
     </div>
     </form>
 </body>
 </html>

See Also

ASPxEdit Class

ASPxEdit Members

DevExpress.Web Namespace