CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Posts
    1

    Repeater Header not visible

    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>
    <asplaceholder id="pages" runat="server"></asplaceholder>
    <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

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Repeater Header not visible

    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
    Code:
    class="tableOverflow"> 
    Hey and there is one thing:
    Both of your tables have
    Code:
    ID="Table1"
    
    And this may lead to troubles at runtime !
    Attached Images Attached Images
    Last edited by JonnyPoet; October 27th, 2008 at 06:27 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured