repeater and SQL question

Discussion in 'ASP .Net' started by SamoK, Jul 4, 2004.

  1. SamoK

    SamoK Guest

    Hy!

    I'm making a little commenting module for news section of my little
    homepage. And I don't know how to embed viewing news comments into it.

    I have repeater like this:
    <asp:Repeater ID="news" Runat="server">
    <ItemTemplate>
    <table width="100%">
    <tr bgcolor="#c6c8b9">
    <td class="newsTitle"><%# DataBinder.Eval(Container.DataItem, "Title")%>
    </td>
    <td width="100" align="right"><%# DataBinder.Eval(Container.DataItem,
    "Date")%> </td>
    </tr>
    <tr bgcolor="#d5d3ca">
    <td colspan="2" class="text"><%# DataBinder.Eval(Container.DataItem,
    "Body")%><br><br>
    <!-- comments goes right here (somewhere) -->
    </td>

    </tr>
    </table>
    <br>
    </ItemTemplate>
    </asp:Repeater>

    I then bind datasource to SqlDataSource (.NET 2.0) -- like this -->
    news.DataSourceID = NewsDS.ID; (pretty much no interaction going on here).

    I have tables news (columns id, title, body, date) and news_comments
    (columns id, body, news_id). news_id is a id of a news to which comment
    belongs.

    What I don't know is, how to select the correct comments and add them into
    the repeater (I've commented the place where I want comments to be).

    Can anyone help me with any solution?


    -- Samo Kralj
    SamoK, Jul 4, 2004
    #1
    1. Advertising

  2. SamoK

    SamoK Guest

    One more thing... I want all this to be done once (at the page load),
    becouse I have then client side code to expand/collapse those comments (it
    isnt seen from code I provided, but I think it is not relavant here).


    "SamoK" <> wrote in message
    news:5rPFc.6167$...
    > Hy!
    >
    > I'm making a little commenting module for news section of my little
    > homepage. And I don't know how to embed viewing news comments into it.
    >
    > I have repeater like this:
    > <asp:Repeater ID="news" Runat="server">
    > <ItemTemplate>
    > <table width="100%">
    > <tr bgcolor="#c6c8b9">
    > <td class="newsTitle"><%# DataBinder.Eval(Container.DataItem,

    "Title")%>
    > </td>
    > <td width="100" align="right"><%# DataBinder.Eval(Container.DataItem,
    > "Date")%> </td>
    > </tr>
    > <tr bgcolor="#d5d3ca">
    > <td colspan="2" class="text"><%# DataBinder.Eval(Container.DataItem,
    > "Body")%><br><br>
    > <!-- comments goes right here (somewhere) -->
    > </td>
    >
    > </tr>
    > </table>
    > <br>
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > I then bind datasource to SqlDataSource (.NET 2.0) -- like this -->
    > news.DataSourceID = NewsDS.ID; (pretty much no interaction going on here).
    >
    > I have tables news (columns id, title, body, date) and news_comments
    > (columns id, body, news_id). news_id is a id of a news to which comment
    > belongs.
    >
    > What I don't know is, how to select the correct comments and add them into
    > the repeater (I've commented the place where I want comments to be).
    >
    > Can anyone help me with any solution?
    >
    >
    > -- Samo Kralj
    >
    >
    SamoK, Jul 4, 2004
    #2
    1. Advertising

  3. On Sun, 4 Jul 2004 10:51:48 +0200, SamoK <> wrote:

    > One more thing... I want all this to be done once (at the page load),
    > becouse I have then client side code to expand/collapse those comments
    > (it
    > isnt seen from code I provided, but I think it is not relavant here).
    >
    >
    > "SamoK" <> wrote in message
    > news:5rPFc.6167$...
    >> Hy!
    >>
    >> I'm making a little commenting module for news section of my little
    >> homepage. And I don't know how to embed viewing news comments into it.
    >>
    >> I have repeater like this:
    >> <asp:Repeater ID="news" Runat="server">
    >> <ItemTemplate>
    >> <table width="100%">
    >> <tr bgcolor="#c6c8b9">
    >> <td class="newsTitle"><%# DataBinder.Eval(Container.DataItem,

    > "Title")%>
    >> </td>
    >> <td width="100" align="right"><%#
    >> DataBinder.Eval(Container.DataItem,
    >> "Date")%> </td>
    >> </tr>
    >> <tr bgcolor="#d5d3ca">
    >> <td colspan="2" class="text"><%# DataBinder.Eval(Container.DataItem,
    >> "Body")%><br><br>
    >> <!-- comments goes right here (somewhere) -->
    >> </td>
    >>
    >> </tr>
    >> </table>
    >> <br>
    >> </ItemTemplate>
    >> </asp:Repeater>
    >>
    >> I then bind datasource to SqlDataSource (.NET 2.0) -- like this -->
    >> news.DataSourceID = NewsDS.ID; (pretty much no interaction going on
    >> here).
    >>
    >> I have tables news (columns id, title, body, date) and news_comments
    >> (columns id, body, news_id). news_id is a id of a news to which comment
    >> belongs.
    >>
    >> What I don't know is, how to select the correct comments and add them
    >> into
    >> the repeater (I've commented the place where I want comments to be).
    >>
    >> Can anyone help me with any solution?
    >>
    >>
    >> -- Samo Kralj
    >>
    >>

    >
    >


    It sounds like you're doing things very similar to this example from MSDN
    magazine:

    http://msdn.microsoft.com/msdnmag/issues/03/10/Blogging/default.aspx

    I use this blog app myself (well, I did port it to C# w/ some mods) and it
    does what you're doing. Your answer and examples are in there.

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Jul 4, 2004
    #3
  4. SamoK

    SamoK Guest

    Thanks Craig... I found that link very useful... and it works now :)
    Thanks again!

    -- Samo

    "Craig Deelsnyder" <cdeelsny@no_spam_4_meyahoo.com> wrote in message
    news:eek:psamlhzvo75dg5d@g51y101...
    > On Sun, 4 Jul 2004 10:51:48 +0200, SamoK <> wrote:
    >
    > > One more thing... I want all this to be done once (at the page load),
    > > becouse I have then client side code to expand/collapse those comments
    > > (it
    > > isnt seen from code I provided, but I think it is not relavant here).
    > >
    > >
    > > "SamoK" <> wrote in message
    > > news:5rPFc.6167$...
    > >> Hy!
    > >>
    > >> I'm making a little commenting module for news section of my little
    > >> homepage. And I don't know how to embed viewing news comments into it.
    > >>
    > >> I have repeater like this:
    > >> <asp:Repeater ID="news" Runat="server">
    > >> <ItemTemplate>
    > >> <table width="100%">
    > >> <tr bgcolor="#c6c8b9">
    > >> <td class="newsTitle"><%# DataBinder.Eval(Container.DataItem,

    > > "Title")%>
    > >> </td>
    > >> <td width="100" align="right"><%#
    > >> DataBinder.Eval(Container.DataItem,
    > >> "Date")%> </td>
    > >> </tr>
    > >> <tr bgcolor="#d5d3ca">
    > >> <td colspan="2" class="text"><%#

    DataBinder.Eval(Container.DataItem,
    > >> "Body")%><br><br>
    > >> <!-- comments goes right here (somewhere) -->
    > >> </td>
    > >>
    > >> </tr>
    > >> </table>
    > >> <br>
    > >> </ItemTemplate>
    > >> </asp:Repeater>
    > >>
    > >> I then bind datasource to SqlDataSource (.NET 2.0) -- like this -->
    > >> news.DataSourceID = NewsDS.ID; (pretty much no interaction going on
    > >> here).
    > >>
    > >> I have tables news (columns id, title, body, date) and news_comments
    > >> (columns id, body, news_id). news_id is a id of a news to which comment
    > >> belongs.
    > >>
    > >> What I don't know is, how to select the correct comments and add them
    > >> into
    > >> the repeater (I've commented the place where I want comments to be).
    > >>
    > >> Can anyone help me with any solution?
    > >>
    > >>
    > >> -- Samo Kralj
    > >>
    > >>

    > >
    > >

    >
    > It sounds like you're doing things very similar to this example from MSDN
    > magazine:
    >
    > http://msdn.microsoft.com/msdnmag/issues/03/10/Blogging/default.aspx
    >
    > I use this blog app myself (well, I did port it to C# w/ some mods) and it
    > does what you're doing. Your answer and examples are in there.
    >
    > --
    > Craig Deelsnyder
    > Microsoft MVP - ASP/ASP.NET
    SamoK, Jul 4, 2004
    #4
    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. Replies:
    0
    Views:
    836
  2. Replies:
    0
    Views:
    2,857
  3. Replies:
    1
    Views:
    7,003
    Karl Seguin
    Aug 10, 2005
  4. uncensored
    Replies:
    0
    Views:
    786
    uncensored
    Oct 25, 2006
  5. ecoolone
    Replies:
    0
    Views:
    731
    ecoolone
    Jan 3, 2008
Loading...

Share This Page