!!!Attention ASP .Net Gurus :: Repeater problem!!!



Hi all,

I have a Repeater problem where the code within the <ItemTemplate> and
<AlternatingItemTemplate> tags are not being executed.

<asp:Repeater ID="myRepeater" Runat="server">
<HeaderTemplate>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td ID="tdMyHeader" Runat="server">
...
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
...
<td><%# DataBinder.Eval(Container.DataItem,
"MyDateTime", "{0:h:mmtt}") %></td>
...
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr>
...
<td><%# DataBinder.Eval(Container.DataItem,
"MyDateTime", "{0:h:mmtt}") %></td>
...
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

The DataSource property on the Repeater is populated with a DataView
containing two records.

....
using (DataView dv = MyDataView())
{
if (dv != null && dv.Count > 0)
{
myRepeater.DataSource = dv;
}
...
}

myRepeater.DataBind();
....

The ItemDataBound event on the Repeater is being set to the
myRepeater_ItemDataBound and successfully executes once the DataBind
method is called.

protected void myRepeater_ItemDataBound(object source,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
...
HtmlTableCell tdMyHeader =
(HtmlTableCell)e.Item.FindControl("tdMyHeader"); // Code stopped on
breakpoint here.
...
}

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
bool didTheCodeStopHere = false; // Code DID NOT stop on
breakpoint here!?!
}

if (e.Item.ItemType == ListItemType.Footer)
{
bool didTheCodeStopHere = true; // Code stopped on breakpoint
here.
}
}

As the above comments state, the code stopped on the Header and Footer
breakpoints however did not stop on the Item/AlternatingItem
breakpoint. Also, when the code stopped on the header and footer
breakpoints I checked the ((DataView)source.DataSource).Count property
and it still contained two records.

Has anyone experience anything similar?

Thanks in advance,

J

.



Relevant Pages

  • Re: !!!Attention ASP .Net Gurus :: Repeater problem!!!
    ... The DataSource property on the Repeater is populated with a DataView ... myRepeater_ItemDataBound and successfully executes once the DataBind ... breakpoint here. ... the code stopped on the Header and Footer ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Repeater Control : Can it work with different data sources?
    ... The repeater, as a control, is made up of templates for rows of data (and ... every second row) and then a header and footer template. ... The norm, when creating a table, is to put the and all header tags ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Repeater Control : Can it work with different data sources?
    ... the table header and footer outside of the Repeater. ... if it's something that I am doing wrong or maybe the repeater control ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: repeater header/footer question
    ... > I've got a repeater control on my page; I've put the and the ... > rows in the header and the in the footer. ... > I would've thought when there were no rows in the datasource, ... > Is there any simple way to not display the header and footer when there ...
    (microsoft.public.dotnet.languages.csharp)
  • Urgent: Postback for Repeaters ItemCommand
    ... I have a Data Repeater with a LinkButton in its ItemTemplte. ... handler for ItemCommand event of the Repeater too. ... code, just page_load executes. ... Deleting project's Assembly and build the project again. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading