DetailsView.EmptyDataRowStyle 속성

정의

TableItemStyle 컨트롤에 바인딩된 데이터 소스에 레코드가 들어 있지 않은 경우 표시되는 빈 데이터 행의 모양을 설정하는 데 사용할 수 있는 DetailsView 개체에 대한 참조를 가져옵니다.

public:
 property System::Web::UI::WebControls::TableItemStyle ^ EmptyDataRowStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle EmptyDataRowStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.EmptyDataRowStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property EmptyDataRowStyle As TableItemStyle

속성 값

TableItemStyle

빈 데이터 행의 모양을 설정하는 데 사용할 수 있는 TableItemStyle에 대한 참조입니다.

특성

예제

다음 코드 예제에서는 빈 데이터 행에 EmptyDataRowStyle 대 한 글꼴 및 스타일 설정을 지정 하는 속성을 사용 하는 방법을 보여 줍니다.


<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>DetailsView EmptyDataText Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>DetailsView EmptyDataText Example</h3>
                
        <asp:detailsview id="StoresDetailView"
          datasourceid="StoresDetailsSqlDataSource"
          autogeneraterows="true" 
          EmptyDataText="No records." 
          runat="server">
               
          <emptydatarowstyle backcolor="Navy"
            forecolor="Red"/> 
                    
        </asp:detailsview>
            
        <!-- This example uses Microsoft SQL Server and connects -->
        <!-- to the Pubs sample database.                        -->
        
        <!-- The select query of the following SqlDataSource     -->
        <!-- control has been intentionally set to return no     --> 
        <!-- results to demonstrate the empty data row.          -->      
        <asp:sqldatasource id="StoresDetailsSqlDataSource"  
          selectcommand="SELECT [stor_id], [stor_name], [stor_address], [city], [state], [zip] FROM [stores] WHERE [state]='FL'"
          connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
          runat="server">
        </asp:sqldatasource>
            
      </form>
  </body>
</html>

<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>DetailsView EmptyDataText Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>DetailsView EmptyDataText Example</h3>
                
        <asp:detailsview id="StoresDetailView"
          datasourceid="StoresDetailsSqlDataSource"
          autogeneraterows="true" 
          EmptyDataText="No records." 
          runat="server">
               
          <emptydatarowstyle backcolor="Navy"
            forecolor="Red"/> 
                    
        </asp:detailsview>
            
        <!-- This example uses Microsoft SQL Server and connects -->
        <!-- to the Pubs sample database.                        -->
        
        <!-- The select query of the following SqlDataSource     -->
        <!-- control has been intentionally set to return no     --> 
        <!-- results to demonstrate the empty data row.          -->      
        <asp:sqldatasource id="StoresDetailsSqlDataSource"  
          selectcommand="SELECT [stor_id], [stor_name], [stor_address], [city], [state], [zip] FROM [stores] WHERE [state]='FL'"
          connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
          runat="server">
        </asp:sqldatasource>
            
      </form>
  </body>
</html>

설명

컨트롤에서 EmptyDataRowStyle 빈 데이터 행 DetailsView 의 모양을 제어하려면 이 속성을 사용합니다. 컨트롤에 바인딩된 데이터 원본에 레코드가 없는 경우 빈 데이터 행이 표시됩니다. 이 속성은 읽기 전용입니다. 그러나의 속성을 설정할 수는 TableItemStyle 개체를 반환 합니다. 속성 형식에서 선언적으로 설정할 수 있습니다 Property-Subproperty, 여기서 Subproperty 속성인 합니다 TableItemStyle 개체 (예를 들어 EmptyDataRowStyle-ForeColor). 형식에서 속성을 프로그래밍 방식으로 설정할 수도 있습니다 Property.Subproperty (예를 들어 EmptyDataRowStyle.ForeColor). 일반적인 설정에는 일반적으로 사용자 지정 배경색, 전경색 및 글꼴 속성이 포함됩니다.

적용 대상

추가 정보