CommandField.UpdateImageUrl 속성

정의

CommandField 필드의 업데이트 단추에 대해 표시할 이미지의 URL을 가져오거나 설정합니다.

public:
 virtual property System::String ^ UpdateImageUrl { System::String ^ get(); void set(System::String ^ value); };
public virtual string UpdateImageUrl { get; set; }
member this.UpdateImageUrl : string with get, set
Public Overridable Property UpdateImageUrl As String

속성 값

String

CommandField의 업데이트 단추에 대해 표시할 이미지의 URL입니다. 기본값은 빈 문자열("")로, 이 속성이 설정되어 있지 않음을 나타냅니다.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 UpdateImageUrl 업데이트 단추에 대해 표시할 사용자 지정 이미지를 지정 하는 속성을 CommandField 필드를 GridView 컨트롤. 합니다 ButtonType 속성으로 설정 되어 있어야 ButtonType.Image 이미지를 표시 하려면 업데이트 단추에 대 한 합니다.


<%@ 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>CommandField Example</title>
</head>
<body>
    <form id="form1" runat="server">
      
      <h3>CommandField Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="false"
        datakeynames="CustomerID"  
        runat="server">
        
        <columns>
          <asp:commandfield showeditbutton="true"
            buttontype="Image"
            editimageurl="~\Images\EditButton.jpg"
            cancelimageurl="~\Images\CancelButton.jpg"
            updateimageurl="~\Images\UpdateButton.jpg"
            headertext="Edit Controls"/>
          <asp:boundfield datafield="CustomerID"
            headertext="Customer ID" />
          <asp:boundfield datafield="CompanyName"
            headertext="Company Name"/>
          <asp:boundfield datafield="Address"
            headertext="Address"/>
          <asp:boundfield datafield="City"
            headertext="City"/>
          <asp:boundfield datafield="PostalCode"
            headertext="ZIP Code"/>
          <asp:boundfield datafield="Country"
            headertext="Country"/>
        </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="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        updatecommand="Update Customers Set CompanyName=@CompanyName, Address=@Address, City=@City, PostalCode=@PostalCode, Country=@Country Where (CustomerID = @CustomerID)"
        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>CommandField Example</title>
</head>
<body>
    <form id="form1" runat="server">
      
      <h3>CommandField Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="false"
        datakeynames="CustomerID"  
        runat="server">
        
        <columns>
          <asp:commandfield showeditbutton="true"
            buttontype="Image"
            editimageurl="~\Images\EditButton.jpg"
            cancelimageurl="~\Images\CancelButton.jpg"
            updateimageurl="~\Images\UpdateButton.jpg"
            headertext="Edit Controls"/>
          <asp:boundfield datafield="CustomerID"
            headertext="Customer ID" />
          <asp:boundfield datafield="CompanyName"
            headertext="Company Name"/>
          <asp:boundfield datafield="Address"
            headertext="Address"/>
          <asp:boundfield datafield="City"
            headertext="City"/>
          <asp:boundfield datafield="PostalCode"
            headertext="ZIP Code"/>
          <asp:boundfield datafield="Country"
            headertext="Country"/>
        </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="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        updatecommand="Update Customers Set CompanyName=@CompanyName, Address=@Address, City=@City, PostalCode=@PostalCode, Country=@Country Where (CustomerID = @CustomerID)"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

설명

때를 ButtonType 의 속성을 CommandField 필드로 설정 됩니다 ButtonType.Image를 사용 하 여를 UpdateImageUrl 업데이트 단추에 대해 표시할 이미지를 지정 하는 속성. 이 이미지는 클라이언트의 브라우저에서 해당 형식을 지원으로 모든 파일 형식 (.jpg,.gif,.bmp, 및 등) 수 있습니다.

참고

업데이트 단추에 대 한 이미지를 표시 하는 대신, 첫 번째 설정에 따라 텍스트를 표시 합니다 ButtonType 속성을 ButtonType.Button 또는 ButtonType.Link 로 설정한는 UpdateText 속성입니다.

적용 대상

추가 정보