ImageField.NullImageUrl プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ImageField.NullImageUrl プロパティの意味・解説 

ImageField.NullImageUrl プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

DataImageUrlField プロパティ指定されフィールドの値が null 参照 (Visual Basic では Nothing) のときに、ImageField オブジェクト表示される代替イメージURL取得または設定します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Overridable Property
 NullImageUrl As String
Dim instance As ImageField
Dim value As String

value = instance.NullImageUrl

instance.NullImageUrl = value
public virtual string NullImageUrl { get;
 set; }
/** @property */
public String get_NullImageUrl ()

/** @property */
public void set_NullImageUrl (String value)
public function get NullImageUrl
 () : String

public function set NullImageUrl
 (value : String)

プロパティ
フィールドの値が null 参照 (Visual Basic では Nothing) のときに表示される代替イメージURL既定値空の文字列 ("") です。この値は、このプロパティ設定されていないことを示します

解説解説

DataImageUrlField プロパティによって指定されフィールドの値が null 参照 (Visual Basic では Nothing) の場合ImageField オブジェクトイメージ表示されません。表示される代替イメージURL指定するには、NullImageUrl プロパティ使用します通常代替イメージには、本来表示されるはずのイメージ利用できないか、見つからなかったことを示すイメージ指定します

メモメモ

このプロパティ代わりに NullDisplayText プロパティ設定することにより、フィールド値が null 参照 (Visual Basic では Nothing) のときに簡単なテキスト表示することもできますNullImageUrl プロパティNullDisplayText プロパティ両方設定されている場合は、NullImageUrl プロパティ優先されます。

使用例使用例

DataImageUrlField プロパティ指定されフィールドの値が null 参照 (Visual Basic では Nothing) のときに表示される代替イメージURL を、NullImageUrl プロパティ使って指定する方法次の例に示します

<%@ 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"
            nullimageurl="~\Images\NoPhoto.jpg"
            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"
            nullimageurl="~\Images\NoPhoto.jpg"
            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>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ImageField クラス
ImageField メンバ
System.Web.UI.WebControls 名前空間
ImageField.NullDisplayText プロパティ


このページでは「.NET Framework クラス ライブラリ リファレンス」からImageField.NullImageUrl プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からImageField.NullImageUrl プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からImageField.NullImageUrl プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ImageField.NullImageUrl プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ImageField.NullImageUrl プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS