私の ASP プロジェクトには 1 つのページがあり、別のリンクをクリックすると、データベースから適切な HTML を取得してロードします。したがって、常にページに配置されているリンクがいくつかありますが (DB から取得されない HTML の一部)、一部の div では HTML を取得し、そこにもリンクがあります。 ASPLinkButton
コントロールとして実行するのが好きです。
これは、fe、常に残ります。
<div id="mainCenter">
<asp:Literal ID="ltlContentCenter" runat="server" />
</div>
したがって、私のコードビハインドには次のものがあります。
protected void Page_Load(object sender, EventArgs e) {
ltlContentCenter.Text = getPageCenter("media"); //function that retrieves
ltlContentSide.Text = getPageSide("media"); // the HTML from the database
}
対応するDBにあるものは次のとおりです。
<div class="onCenterSmall">
<asp:LinkButton ID="LinkButton10" Text="test" CommandArgument="test" OnCommand="loadPage_Command"
runat="server" />
</div>
<div class="onCenterSmall"></div>
<div class="onCenterSmall"></div>
その HTML のチャンクは<div id="mainCenter"><!-- in here --></div>
、ページ上の の間に挿入されます。ご覧のとおり、結果は文字列として取得されます。HTML コードの場合は問題<asp:LinkButton...
ありませんが、完全に機能しません。すべての作業を同じ方法で (または少なくともロジックを維持するために) 行う方法を教えLinkButton control
てください。