EDITH:
我改变了方式,我正在尝试这样做,但仍然没有出错,这是首页:
<asp:Repeater runat="server" ID="rptCamposAnonimo">
<ItemTemplate>
<div class='col-md-<%# rptTamanhoA(Container) %>'style='padding-left: 15px; padding-right: 15px;'>
<label><%# rptNomeA(Container) %>:</label>
<asp:TextBox runat='server' ID='txtCampoA' CssClass="<%# rptIdA(Container) %>"></asp:TextBox>
</div>
</ItemTemplate>
</asp:Repeater>
工作正常,背部:
try
{
foreach (Control ctr in (rptCamposAnonimo.Controls))
{
if (ctr is RepeaterItem)
{
foreach (Control rpt in ctr.Controls)
{
if (rpt is TextBox)
{
campos.Mensagem = ((TextBox)rpt).Text;
campos.Denuncia = denuncia.ID;
var idC = rpt as TextBox;
campos.ID = Convert.ToInt32((idC).CssClass);
Servicos.Campos.SalvarCamposDenuncia(campos);
}
}
}
}
}
catch (Exception)
{
}
我可以得到所有价值,但((TextBox)rpt).Text
却无法获得价值,但是却没有得到价值。