Click to See Complete Forum and Search --> : Repeater Header not visible


ravi_y4u
October 26th, 2008, 05:08 AM
Hi,
I have 4 repeaters display some information webpage.I am giving the code here below.please give me the solution.
I have 2 tables.I have display them one below other.I have 2 repeaters in each table.one to display head and other to contents.But when i run the code i could see one header only but the contents in itemtemplate of both repeaters are visible.But the other one which is not visible is rendered when i see in viewsource of the rendered page.
If i comment the databinding code of the other repeater i could see the repeater head which i didn't see before.
This is the code i have written in page load

void Page_Load()

{

repno=int.Parse(Session["repno"].ToString());

username=Session["uname"].ToString();

DataListHeaderBind();

DataListItemsBind();

}

private Void DataListHeaderBind()

{

SqlDataReader drrptAllUsersHead=CMS.GetAllUsers(int repno); rptAllUsersHead.DataSource=drrptAllUsersHead;

rptAllUsersHead.DataBind();

SqlDataReader drrptUserHead=CMS.GetUserDetails(string username); rptUserHead.DataSource=drrptUserHead;

rptUserHead.DataBind();

}

Private Void DataListItemsBind()

{

SqlDataReader drrptAllUsers=CMS.GetAllUsers(int repno); rptAllUsers.DataSource=drrptAllUsers;

rptAllUsers.DataBind();

SqlDataReader drrptUser=CMS.GetUserDetails(string username); rptUser.DataSource=drrptUser;
rptUser.DataBind();

}


<%@ Page language="c#" Codebehind="UserDetails.aspx.cs" AutoEventWireup="True" Inherits="CMS.UserDetails" MasterPageFile="~/CMS.Master"%>
<%@ MasterType VirtualPath="~/CMS.Master"%>
<asp:Content id="content1" ContentPlaceHolderID="MainContent" runat="server">
<h2><span>Enterprise List</span></h2>
<div class="clear"></div>
<div class="lvl2">
<asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<div class="tableWrapper">
<div class="tableOverflow">
<div class="ie6fix">

<table id="Table1" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<asp:Repeater id="rptAllusersHead" runat="server">
<HeaderTemplate>
<th style="width: 5%;">Username</th>
<th style="width: 5%;">FirstName </th>
<th style="width: 6%;">LastName</th>
<th style="width: 9%;">FatherName</th>
</HeaderTemplate>
</asp:Repeater>
</tr>
</thead>
<tbody>
<asp:Repeater ID="rptAllusers" runat="server" >
<ItemTemplate>
<tr class="alignCenter">
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "username" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "firstName" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "lastName" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "fatherName" )%>'> </td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
<div><h2> User Details</h2><br/></div>

<table id="Table1" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<asp:Repeater id="rptuserHead" runat="server">
<HeaderTemplate>
<th style="width: 5%;">Username</th>
<th style="width: 5%;">Address </th>
<th style="width: 6%;">City</th>
<th style="width: 9%;">Zip</th>
</HeaderTemplate>
</asp:Repeater>
</tr>
</thead>
<tbody>
<asp:Repeater ID="rptuser" runat="server" >
<ItemTemplate>
<tr class="alignCenter">
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "username" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "address" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "city" )%>'> </td>
<td style="width: 5%" align="center" title='<%# DataBinder.Eval( Container.DataItem, "zip" )%>'> </td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
</div>

<div id="Paging" runat="server" class="pagination">
<asp:Label runat="server" id="lblTotalPages"/>
<asp:TextBox id="txtPageIndex" runat="server" width="50px" visible="false" />
<a id="imgPrev" runat="server" onserverclick="SetCurrentPage" title="Previous"><< Prev</a>
<asp:placeholder id="pages" runat="server"></asp:placeholder>
<a id="imgNext" type="image" onserverclick="SetCurrentPage" runat="server" title="Next">Next >></a>
<asp:Label runat="server" id="lblRecordsPerPage"/>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>

Please give me the solution i have wasted whole day for this.
I even tried taking onther table and putting table1 and table2 in separate rows.It didn't work for me.
I tried by taking two repeaters instead of 4, using HeaderTemplate and ItemTemplate of the same repeater to display header and Contents(Before i used separate repeater to display header and Items) it also not worked.
I could see one header on top of the page even it is in Second table.
Thanks Inadvance,
Ravi

JonnyPoet
October 27th, 2008, 05:53 AM
I loaded your Contents code on a 2008 web site project and it look like the following picture As I have no data I cannot get any datatables visible there but the general design seems to fit or is something missing in this picture ? I looked at the structure, it seems me fine, what is contained in the class="tableOverflow"> Hey and there is one thing:
Both of your tables have

ID="Table1"
And this may lead to troubles at runtime !