I created a repeater and I can not render it. When I inspect the object, it does not appear. I took the code above it, called Analyze cadastral data and repeat after the repeater and I can see, but the repeater does not. What could be wrong? Below is the code from Analyze cadastral data:
<div class="boxAprovacao">
<h2>Analisar dados cadastrais</h2>
<asp:HiddenField ID="hdfCdPendencia" runat="server" />
<asp:RadioButtonList ID="rblIcAprovado" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Aprovar" Value="1"></asp:ListItem>
<asp:ListItem Text="Reprovar" Value="0"></asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="txtParecerDadosCadastrais" TextMode="MultiLine" runat="server" CssClass="parecerAnalista" />
<asp:HiddenField ID="hdfCdUsuario" runat="server" />
<asp:Repeater ID="rptHistoricoAnalises" runat="server" OnItemDataBound="rptHistoricoAnalises_ItemDataBound">
<HeaderTemplate>
<h3>Histórico de análises</h3>
<dl>
</HeaderTemplate>
<ItemTemplate>
<dt>
Por:
<asp:Label Text="ANA LUCIA ALVES MARTINS" ID="lblHistAnaNmAnalista" runat="server" /><br />
Em: <asp:Label Text="03/12/2014" ID="lblHistAnaData" runat="server" /> - <asp:Label Text="10:19" ID="lblHistAnaHorario" runat="server" />
</dt>
<dd>
<asp:Label Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque bibendum diam augue, ut varius lectus luctus a. Sed finibus fringilla nibh. Quisque orci erat, iaculis quis neque vitae, maximus vehicula tortor. Praesent luctus venenatis venenatis. Nullam non lacus orci. Vivamus convallis hendrerit urna, vel facilisis sapien semper non." ID="lblHistAnaParacerAnalista" runat="server" />
</dd>
</ItemTemplate>
<FooterTemplate>
</dl>
</FooterTemplate>
</asp:Repeater>
</div>
So the whole question is because I have several repeaters in my project and none of them I have a DataSource so explicit, as you are telling me to do. See this example I have here in my project of a repeater that works and has nothing so explicit.
<asp:Repeater ID="rptTitulares" runat="server"
onitemcommand="rptTitulares_ItemCommand"
OnItemDataBound="rptTitulares_ItemDataBound">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" width="970px">
<thead>
<tr>
<th> </th>
<th> </th>
<th class="nameSize">Nome</th>
<th>Tipo</th>
<th>E-mail</th>
<th>Data Cadastro</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tbody>
<tr>
<td>
<asp:LinkButton Text="Excluir" ID="lkbExcluirTitular" runat="server" OnClientClick="return confirm('Tem certeza que deseja excluir o Titular selecionado ?');"/>
</td>
<td>
<asp:LinkButton Text="Exibir ficha" ID="lkbExibirFicha" runat="server" />
<asp:HiddenField ID="CdPessoa" Value='<%# Eval("CdPessoa")%>' runat="server" />
</td>
<td><asp:Label ID="lblNomeTitular" Text='<%# Eval("NmPessoa")%>' runat="server" /></td>
<td><asp:Label ID="lblTipoPessoa" Text='<%# Eval("NmTipoPessoa")%>' runat="server" /></td>
<td><asp:Label ID="lblEmail" Text='<%# Eval("DsEmail")%>' runat="server" /></td>
<td><asp:Label ID="lblDtExpiraCadastro" Text='<%# Eval("DtExpiraCadastro")%>' runat="server" /></td>
</tr>
</tbody>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
I ask the following question. If I have a method that returns me a list and picks up each item from the list and popular my repeater, type, <% # Eval ("Field_1")% > can I guarantee that I have a DataSource there, without the need to make it explicit?
It is in this method that I fill in my repeater.
private void PreencherTitluarAvalista(List<ENTSPTitularesAvalistas> palstPessoas)
{
//Declarações
List<ENTSPTitularesAvalistas> vlstTitular = null;
List<ENTSPTitularesAvalistas> vlstAvalista = null;
try
{
//Instâncias e Inicializações
vlstTitular = new List<ENTSPTitularesAvalistas>();
vlstAvalista = new List<ENTSPTitularesAvalistas>();
//Desenvolvimento
if (palstPessoas != null)
{
for (int i = 0; i < palstPessoas.Count; i++)
{
if (palstPessoas[i].CdFuncaoPessoa == 1)
{
vlstTitular.Add(palstPessoas[i]);
}
else
{
vlstAvalista.Add(palstPessoas[i]);
}
}
}
if (vlstTitular.Count > 0)
{
rptTitulares.DataSource = vlstTitular;
rptTitulares.DataBind();
}
else
{
rptTitulares.DataSource = null;
rptTitulares.DataBind();
}
if (vlstAvalista.Count > 0)
{
rptAvalistas.DataSource = vlstAvalista;
rptAvalistas.DataBind();
}
else
{
rptAvalistas.DataSource = null;
rptAvalistas.DataBind();
}
switch (int.Parse(cmbCdTipoProcesso.SelectedValue))
{
case 1:
pnlTitulares.Visible = true;
pnlNovoTitutlar.Visible = false;
pnlAvalistas.Visible = true;
pnlNovoAvalista.Visible = false;
break;
case 2:
pnlTitulares.Visible = true;
pnlNovoTitutlar.Visible = false;
pnlAvalistas.Visible = true;
pnlNovoAvalista.Visible = false;
break;
case 3:
pnlTitulares.Visible = true;
pnlNovoTitutlar.Visible = false;
pnlAvalistas.Visible = true;
pnlNovoAvalista.Visible = false;
break;
case 4:
pnlTitulares.Visible = true;
pnlNovoTitutlar.Visible = false;
pnlAvalistas.Visible = true;
pnlNovoAvalista.Visible = false;
break;
}
}
catch
{
throw;
}
}