我已经为此工作了大约两天....我有一个RadioButtonList,后来被替换为PDFB打印的RadioButtonListPrint。当单选按钮不在表格中时,它工作正常,但在表格中,我无法让ListPrint进入表格。任何想法?感谢。
此代码
Control ct;
tempControl = new RadioButtonListPrint();
tempControl.ID = ct.ID + "_print";
((RadioButtonListPrint)tempControl).CopyRadioButtonListAttributes(((RadioButtonList)ct));
((RadioButtonList)ct).Visible = false;
ct.Parent.Controls.Add(tempControl);
有这个输出......
答案 0 :(得分:1)
你必须找到你想要添加的控件(Table),如果你只是将它添加到Container,它将只是你在ControlTree中的最后一个Control:
<强>标记式:强>
<table>
<tr>
<td id="putMeHere" runat="server"></td>
</tr>
</table>
<强>代码:强>
HtmlTableCell td = [fill in the container control here].FindControl("putMeHere") as HtmlTableCell; //
td.Controls.Add(tempControl);