DataGrid.CreateControlStyle メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGrid.CreateControlStyle メソッドの意味・解説 

DataGrid.CreateControlStyle メソッド

新しコントロール スタイル作成します

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

Protected Overrides Function
 CreateControlStyle As Style
Dim returnValue As Style

returnValue = Me.CreateControlStyle
protected override Style CreateControlStyle ()
protected:
virtual Style^ CreateControlStyle () override
protected Style CreateControlStyle ()
protected override function CreateControlStyle
 () : Style

戻り値
新しいスタイルを表す Style

使用例使用例

カスタム サーバー コントロールCreateControlStyle メソッドオーバーライドして、常に CellSpacing のない GridLines が DataGrid に表示されるようにする方法次のコード例示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page language="VB" %>
<HTML>
  <HEAD>
    <title>Custom DataGrid - CreateControlStyle - VB.NET Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post"
 runat="server">
      <h3>Custom DataGrid - CreateControlStyle - C# Example</h3>
            <aspSample:CustomDataGridCreateControlStyle id="Datagrid1"
 runat="server" AutoGenerateColumns="False">
                <Columns>
                    <asp:HyperLinkColumn Text="www.microsoft.com"
 Target="_blank" HeaderText="HyperLinks"
 NavigateUrl="http://www.microsoft.com" />
                </Columns>
            </aspSample:CustomDataGridCreateControlStyle>
    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br
 />Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomDataGridCreateControlStyle
        Inherits System.Web.UI.WebControls.DataGrid

        Protected Overrides Function
 CreateControlStyle() As System.Web.UI.WebControls.Style

            ' Create a new TableStyle instance based on ViewState values.
            Dim style As New
 System.Web.UI.WebControls.TableStyle(ViewState)

            ' Show the GridLines with no CellSpacing.
            style.GridLines = System.Web.UI.WebControls.GridLines.Both
            style.CellSpacing = 0

            ' Return the Style
            Return style
        End Function
    End Class
End Namespace
<%@ Page language="c#" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<HTML>
  <HEAD>
    <title>Custom DataGrid - CreateControlStyle - C# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom DataGrid - CreateControlStyle - C# Example</h3>
      <aspSample:CustomDataGridCreateControlStyle id="Datagrid1" runat="server"
 AutoGenerateColumns="False">
        <Columns>
          <asp:HyperLinkColumn Text="www.microsoft.com" Target="_blank"
 HeaderText="HyperLinks" NavigateUrl="http://www.microsoft.com"
 />
        </Columns>
      </aspSample:CustomDataGridCreateControlStyle>
    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br />using
 System.Web;
using System.Security.Permissions;
namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomDataGridCreateControlStyle
 : System.Web.UI.WebControls.DataGrid
    {
        protected override System.Web.UI.WebControls.Style CreateControlStyle()
        {
            // Create a new TableStyle instance based on ViewState values.
            System.Web.UI.WebControls.TableStyle style = new System.Web.UI.WebControls.TableStyle(ViewState);
            
            // Show the GridLines with no CellSpacing.
            style.GridLines = System.Web.UI.WebControls.GridLines.Both;
            style.CellSpacing = 0;

            // Return the Style
            return style;
        }
    }
}
<%@ Page language="VJ#" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<HTML>
  <HEAD>
    <title>Custom DataGrid - CreateControlStyle - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom DataGrid - CreateControlStyle - VJ# Example</h3>
      <aspSample:CustomDataGridCreateControlStyle id="Datagrid1" runat="server"
 AutoGenerateColumns="False">
        <Columns>
          <asp:HyperLinkColumn Text="www.microsoft.com" Target="_blank"
 HeaderText="HyperLinks" NavigateUrl="http://www.microsoft.com"
 />
        </Columns>
      </aspSample:CustomDataGridCreateControlStyle>
    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br />package
 Samples.AspNet.JSL.Controls;

public class CustomDataGridCreateControlStyle
    extends System.Web.UI.WebControls.DataGrid
{
    protected System.Web.UI.WebControls.Style CreateControlStyle()
    {
        // Create a new TableStyle instance based on ViewState values.
        System.Web.UI.WebControls.TableStyle style = 
            new System.Web.UI.WebControls.TableStyle(get_ViewState());
        // Show the GridLines with no CellSpacing.
        style.set_GridLines(System.Web.UI.WebControls.GridLines.Both);
        style.set_CellSpacing(0);
        // Return the Style
        return style;
    } //CreateControlStyle
} //CustomDataGridCreateControlStyle
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGrid クラス
DataGrid メンバ
System.Web.UI.WebControls 名前空間
Style


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

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

辞書ショートカット

すべての辞書の索引

DataGrid.CreateControlStyle メソッドのお隣キーワード
検索ランキング

   

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



DataGrid.CreateControlStyle メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS