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

Dim instance As ImageField Dim value As String value = instance.NullDisplayText instance.NullDisplayText = value
[LocalizableAttribute(true)] public: virtual property String^ NullDisplayText { String^ get (); void set (String^ value); }
/** @property */ public String get_NullDisplayText () /** @property */ public void set_NullDisplayText (String value)
public function get NullDisplayText () : String public function set NullDisplayText (value : String)
フィールドの値が null 参照 (Visual Basic では Nothing) のときに表示されるテキスト。既定値は空の文字列 ("") です。この値は、このプロパティが設定されていないことを示します。

DataImageUrlField プロパティによって指定されたフィールドの値が null 参照 (Visual Basic では Nothing) の場合、ImageField オブジェクトにイメージは表示されません。イメージの位置に表示されるテキストを指定するには NullDisplayText プロパティを使用します。通常、代替テキストには、本来表示されるはずのイメージが利用できないか、見つからなかったことを示すテキストを指定します。
![]() |
---|
このプロパティの代わりに NullImageUrl プロパティを設定することにより、フィールド値が null 参照 (Visual Basic では Nothing) のときに代替イメージを表示することもできます。NullImageUrl プロパティと NullDisplayText プロパティの両方が設定されている場合は、NullImageUrl プロパティが優先されます。 |
このプロパティの値は、設定時に、デザイナ ツールを使用してリソース ファイルに自動的に保存できます。詳細については、LocalizableAttribute、ASP.NET のグローバリゼーションおよびローカリゼーション の各トピックを参照してください。

DataImageUrlField プロパティで指定されたフィールドの値が null 参照 (Visual Basic では Nothing) のときに表示されるテキストを、NullDisplayText プロパティを使って指定する方法を次の例に示します。
<%@ Page language="VB" %> <html> <body> <form runat="server"> <h3>ImageField Example</h3> <asp:gridview id="EmployeesGrid" autogeneratecolumns="false" datasourceid="EmployeeSource" 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]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <html> <body> <form runat="server"> <h3>ImageField Example</h3> <asp:gridview id="EmployeesGrid" autogeneratecolumns="false" datasourceid="EmployeeSource" 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]" 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.NullDisplayText プロパティを検索する場合は、下記のリンクをクリックしてください。

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