I have a sharepoint web part where I am programatically adding a button to the page. When the button renders, it has no name or ID. I am doing the following in the code behind of the web part:
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);
}
}
and this is what gets rendered:
<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>
Notice how the input tag gets rendered with no name and no id... I would expect to see something like ID="ctl00$m$g_2d506746_d91e_4508_8cc4_649e463e1537$ctl13" or something.
Any ideas as to why the button control is not rendering with the name and IDs that .NET normally generates?
Thanks,
Ryan