ImageField.ReadOnly プロパティ
アセンブリ: System.Web (system.web.dll 内)

/** @property */ public boolean get_ReadOnly () /** @property */ public void set_ReadOnly (boolean value)
編集モードでフィールドの値を編集できない場合は true。それ以外の場合は false。既定値は false です。

既定では、データ バインド コントロールが編集モードのとき、DataImageUrlField プロパティで指定されたフィールドの値をユーザーが編集モードで変更できるように設定されています。フィールドの値をユーザーが変更できないようにするには、このプロパティを true に設定します。
![]() |
---|
ImageField オブジェクトの DataImageUrlField プロパティには、オブジェクトに表示されるイメージの URL が格納されたフィールドの名前が格納されます。 |

ReadOnly プロパティを使用し、ImageField オブジェクトに表示されるイメージの URL を表すフィールド値を編集モードで変更できないように指定する方法を次の例に示します。
<%@ Page language="VB" %> <html> <body> <form runat="server"> <h3>ImageField ReadOnly Example</h3> <asp:gridview id="EmployeesGrid" autogeneratecolumns="false" datasourceid="EmployeeSource" autogenerateeditbutton="true" datakeynames="EmployeeID" runat="server"> <columns> <asp:imagefield dataimageurlfield="PhotoPath" alternatetext="Employee Photo" nulldisplaytext="No image on file." headertext="Photo" readonly="true"/> <asp:boundfield datafield="FirstName" headertext="First Name"/> <asp:boundfield datafield="LastName" headertext="Last Name"/> </columns> </asp:gridview> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName], [PhotoPath] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName Where [EmployeeId]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <html> <body> <form runat="server"> <h3>ImageField ReadOnly Example</h3> <asp:gridview id="EmployeesGrid" autogeneratecolumns="false" datasourceid="EmployeeSource" autogenerateeditbutton="true" datakeynames="EmployeeID" runat="server"> <columns> <asp:imagefield dataimageurlfield="PhotoPath" alternatetext="Employee Photo" nulldisplaytext="No image on file." headertext="Photo" readonly="true"/> <asp:boundfield datafield="FirstName" headertext="First Name"/> <asp:boundfield datafield="LastName" headertext="Last Name"/> </columns> </asp:gridview> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName], [PhotoPath] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName Where [EmployeeId]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からImageField.ReadOnly プロパティを検索する場合は、下記のリンクをクリックしてください。

- ImageField.ReadOnly プロパティのページへのリンク