Data not displayed in Repeater

Discussion in 'ASP .Net' started by =?Utf-8?B?S2lt?=, Dec 1, 2005.

  1. I created a Repeater (rp1) that is bound to a Datatable, t1. The DataSource
    and Datamember properties of rp1 was specified in the properties window as
    "ds" and "t1" respectively.

    The following code was also included in the HTML view of the form. However,
    only the HeaderTemplate rendered in the browser.

    <asp:Repeater id="rp1" runat="server">
    <HeaderTemplate>
    <Table><tr>
    <td>Song Name</td>
    <td>Artist</td>
    <td>Genre</td>
    </tr></Table>
    </HeaderTemplate>
    <ItemTemplate>
    <Table><tr>
    <td><%# DataBinder.Eval(Container, "DataItem.Song Name") %>
    <%# DataBinder.Eval(Container, "DataItem.Artist") %>
    <%# DataBinder.Eval(Container, "DataItem.Genre")>
    </td>
    </tr></Table>
    </ItemTemplate>
    </asp>
     
    =?Utf-8?B?S2lt?=, Dec 1, 2005
    #1
    1. Advertising

  2. 2 observations:
    1) The markup below is not well-formed. You have there an ending </asp>
    instead of </asp:Repeater>,
    2) The repeater will render the HeaderTemplate if the datatable is empty
    (i.e. no records were retrieved by the query). Use the debugger to step
    through the code and verify that you data query retrieved records.
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Kim" wrote:

    > I created a Repeater (rp1) that is bound to a Datatable, t1. The DataSource
    > and Datamember properties of rp1 was specified in the properties window as
    > "ds" and "t1" respectively.
    >
    > The following code was also included in the HTML view of the form. However,
    > only the HeaderTemplate rendered in the browser.
    >
    > <asp:Repeater id="rp1" runat="server">
    > <HeaderTemplate>
    > <Table><tr>
    > <td>Song Name</td>
    > <td>Artist</td>
    > <td>Genre</td>
    > </tr></Table>
    > </HeaderTemplate>
    > <ItemTemplate>
    > <Table><tr>
    > <td><%# DataBinder.Eval(Container, "DataItem.Song Name") %>
    > <%# DataBinder.Eval(Container, "DataItem.Artist") %>
    > <%# DataBinder.Eval(Container, "DataItem.Genre")>
    > </td>
    > </tr></Table>
    > </ItemTemplate>
    > </asp>
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Dec 1, 2005
    #2
    1. Advertising

  3. There are data within the DataTable and I placed the breakpoint on the 1st
    statement at <%# DataBind.Eval(Container, "DatatItem.SongName") %>.

    The JScript code was stepped through and the data are still not displayed.
    Don't know what's wrong.

    "Phillip Williams" wrote:

    > 2 observations:
    > 1) The markup below is not well-formed. You have there an ending </asp>
    > instead of </asp:Repeater>,
    > 2) The repeater will render the HeaderTemplate if the datatable is empty
    > (i.e. no records were retrieved by the query). Use the debugger to step
    > through the code and verify that you data query retrieved records.
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "Kim" wrote:
    >
    > > I created a Repeater (rp1) that is bound to a Datatable, t1. The DataSource
    > > and Datamember properties of rp1 was specified in the properties window as
    > > "ds" and "t1" respectively.
    > >
    > > The following code was also included in the HTML view of the form. However,
    > > only the HeaderTemplate rendered in the browser.
    > >
    > > <asp:Repeater id="rp1" runat="server">
    > > <HeaderTemplate>
    > > <Table><tr>
    > > <td>Song Name</td>
    > > <td>Artist</td>
    > > <td>Genre</td>
    > > </tr></Table>
    > > </HeaderTemplate>
    > > <ItemTemplate>
    > > <Table><tr>
    > > <td><%# DataBinder.Eval(Container, "DataItem.Song Name") %>
    > > <%# DataBinder.Eval(Container, "DataItem.Artist") %>
    > > <%# DataBinder.Eval(Container, "DataItem.Genre")>
    > > </td>
    > > </tr></Table>
    > > </ItemTemplate>
    > > </asp>
     
    =?Utf-8?B?S2lt?=, Dec 6, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim French
    Replies:
    0
    Views:
    629
    Jim French
    Jul 18, 2003
  2. Andrew Chalk
    Replies:
    4
    Views:
    788
    Andrew Chalk
    Oct 24, 2005
  3. boney
    Replies:
    1
    Views:
    606
  4. Replies:
    1
    Views:
    197
  5. Andrew Chalk

    Sorting a dataset displayed using a repeater

    Andrew Chalk, Oct 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    157
    Andrew Chalk
    Oct 24, 2005
Loading...

Share This Page