商品一覧ページ(ProductList.aspx)にて、
カテゴリ別にコンテンツを設置する方法を記載します。
使用するファイル
■コンテンツの内容が記述されているファイル
/R1205_TofuMoritaya_Test/Form/Common/Tof/TofProductListDokudamiContents.ascx
/R1205_TofuMoritaya_Test/Form/Common/Tof/TofProductListKinmayuContents.ascx
※TofProductList + 〇〇 + Contents の形式で命名しています。
■上記コンテンツファイルの読み込みを指定しているファイル(商品一覧テンプレート)
[ PC ]
/R1205_TofuMoritaya_Test/Form/Product/ProductList.aspx
[ SP ]
/R1205_TofuMoritaya_Test/SmartPhone/Form/Product/ProductList.aspx
コンテンツの設置方法
1. コンテンツファイルの作成
コンテンツファイルを作成する。
PC / SP ともに、PCディレクトリのファイルを読み込むため、
PCディレクトリでのみ、ファイルを作成する。
■コンテンツファイルのディレクトリ
/R1205_TofuMoritaya_Test/Form/Common/Tof/TofProductListDokudamiContents.ascx
/R1205_TofuMoritaya_Test/Form/Common/Tof/TofProductListKinmayuContents.ascx
※TofProductList + 〇〇 + Contents の形式で命名しています。
■手順
①上記コンテンツファイルを複製
②1行目の記述の値を変更
<%@ Control Language="C#" ClassName="TofProductListDokudamiContents" Inherits="BaseUserControl" %>
↓
<%@ Control Language="C#" ClassName="今回作成したファイル名" Inherits="BaseUserControl" %>
③通常通りコーディング
2. 商品一覧テンプレートにて、上記コンテンツファイルを読み込む
PC / SP それぞれのファイルにて、
上記コンテンツファイルを読み込むための記述を追記する。
■商品一覧テンプレートのディレクトリ
[ PC ]
/R1205_TofuMoritaya_Test/Form/Product/ProductList.aspx
[ SP ]
/R1205_TofuMoritaya_Test/SmartPhone/Form/Product/ProductList.aspx
■手順 (PCを基準に説明しますが、手順はSPも同じです。)
①コンテンツファイルを読み込むための宣言を行う
ユーザーコントロール宣言領域内に記述を追記
<%-- ▽ユーザーコントロール宣言領域▽ --%>
~
<%@ Register TagPrefix="uc" TagName="今回作成したファイル名" Src="~/Form/Common/Tof/今回作成したファイル名.ascx" %>
<%-- △ユーザーコントロール宣言領域△ --%>

②コンテンツファイルを読み込む記述を追記<!--▽ 〇〇カテゴリブブコン ▽-->
<% if (this.CategoryId == "カテゴリID"){ %>
<div class="bscstm">
<uc:今回作成したファイル名 id="今回作成したファイル名" runat="server"></uc:今回作成したファイル名>
</div>
<% } %>
<!--△ 〇〇カテゴリブブコン △-->

■注意事項
ProductList.aspx にて、
「今回作成したファイル名」に存在しないファイル名を指定してしまうと、
エラーで商品一覧ページが閲覧できなくなります。(全カテゴリ)