プログラムでページにボタンを追加する SharePoint Web パーツがあります。ボタンがレンダリングされるとき、名前も ID もありません。Web パーツのコード ビハインドで次のことを行っています。
public class ChartControl : WebPart
{
protected Button BubbleChartApplyButton;
protected override void CreateChildControls()
{
BubbleChartApplyButton = new Button {Text = "Apply This"};
}
protected override void RenderWebPart(HtmlTextWriter output)
{
BubbleChartApplyButton.RenderControl(output);
}
}
これがレンダリングされるものです:
<div WebPartID="4844c2e5-2dd5-437b-a879-90c2e1e21f69" HasPers="false" id="WebPartWPQ2" width="100%" class="ms-WPBody ms-wpContentDivSpace" allowDelete="false" style="" >
<input type="submit" value="Apply This" />
...more output here...
</div>
入力タグが名前と ID なしでどのようにレンダリングされるかに注意してください... ID="ctl00$m$g_2d506746_d91e_4508_8cc4_649e463e1537$ctl13" などのようなものが表示されると予想されます。
.NET が通常生成する名前と ID でボタン コントロールがレンダリングされない理由について何か考えはありますか?
ありがとう、
ライアン