First item disappears in datalist and data repeater

  • Thread starter Thread starter Simon Cheng
  • Start date Start date
S

Simon Cheng

When I tried to display data in datalist and repeater, the first data item
always disappears in all datalist and repeaters in my web forms. The code I
use for the html page is:

<TD id="tdDepartment" runat="server"><asp:datalist id="dlstDept"
runat="server" HorizontalAlign="Left" CellPadding="0" Width="100%">
<HeaderTemplate>
<p><b>Department Info</b></p>
</HeaderTemplate>
<ItemTemplate>
<font size="2">&nbsp;&nbsp; <a href='department.aspx?id=<%#
databinder.eval(container.dataitem, "DeptID")%>' class="categoryLink">
<%# databinder.eval(container.dataitem, "DeptName") %>
</a></font>
</ItemTemplate>
</asp:datalist></TD>


And the code I use for the VB page is:

With dlstDept
.DataSource = drDept
.DataBind()
End With

Where drDept is an ODBCDataReader, since I am using MySQL.

(note: This issue only happened in the datalist and repeater of my web
project, everything else (including listbox and dropdown) is fine.)

One thing I am not sure is the, class="categoryLink", part.... Please help!

Any advise are very appreciated. Thank you!
 
* "Simon Cheng said:
When I tried to display data in datalist and repeater, the first data item
always disappears in all datalist and repeaters in my web forms. The code I
use for the html page is:

<TD id="tdDepartment" runat="server"><asp:datalist id="dlstDept"
runat="server" HorizontalAlign="Left" CellPadding="0" Width="100%">
<HeaderTemplate>
<p><b>Department Info</b></p>
</HeaderTemplate>
<ItemTemplate>
<font size="2">&nbsp;&nbsp; <a href='department.aspx?id=<%#
databinder.eval(container.dataitem, "DeptID")%>' class="categoryLink">
<%# databinder.eval(container.dataitem, "DeptName") %>
</a></font>
</ItemTemplate>
</asp:datalist></TD>

<<<
 
Back
Top