DataList Databind (Forums and Comments) RRS feed

  • Question

  • Hi All,

    Bind the two tables data to a datlist like a forums. I have two tables those are tbl_feedbacks (msgid, message, date, rate, empid) and tbl_feedbackmessages (Id,msgid, comments,date,empid). Now i want to bind the data list first. First one should be message and bellow of that bind the comments which are related to that message id. I am able to get the records but how can i bind like forums. Please guide me how solve this. Thanks in an advance.

    Thanks& Regards,


    Monday, December 13, 2010 5:16 PM


  • Hi Jeevan,

    Welcome to MSDN Forum. I am Jackie.

    Here is an example for datalist databind,  hope it can help.

    <asp:DataList ID="DataList1" runat="server" Font-Size="12px" Width="100%"            DataKeyField="ProductID">





                        <asp:Label ID="Lbl_au_id" Text='<%#Eval("au_id")%>' runat="server"></asp:Label>



     At .cs file, you should set the datasource like this:

              DataList1.DataSource = the object you have got    


    Then you will see the data you want has displayed in the UI.

    I hope this will help resolve your problem, if anything is unclear, please feel free to let me know.

    Thank you for your understanding and support. I look forward to hearing from you.

    Best Regards,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 17, 2010 9:49 AM