0
I created a Repeater and I can’t render it. When I inspect the object, it doesn’t appear. I took the code above it, called Analyze registration data and repeated after the Reset and can view, but the Reset does not. What could be wrong? Below the code from Analyze Registration 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 Rewinds in my project and none of them I have a Datasource like this, explicit as you are telling me to do. See this example that 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 on the list and popular my Peater, type, <%#Eval("Campo_1")%> I can guarantee that I have a Datasource there, without the need to clarify?
This is the method I fill in my Reset.
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;
}
}
You set the Datasource and gave Databind() on it? Check and comment.
– Fernando Leal
I think that’s exactly what it is. The people in the O.R..
– pnet
Where you are passing the data (list of items) to that your second "rptTitulares"?
– Fernando Leal
So that’s what I’m talking about. I can’t see explicitly. What I have are methods returning values and getting caught on Asp.net with the Eval function()
– pnet
@Fernando, I thought yes, it was bad. There really exists explicitly the Databind() on top of the Peater. I think I now managed to find the way.
– pnet
I found it strange, because without data, there is no logic for the
Repeater
work, after all the concept ofDataSource
is data source, be it a list, aquery
(Cursor), etc.– Fernando Leal