From: Guabble on

Can anyone help me? I want to be able to show my sqldatareader
contents in a gridview whereby the child data is concatenated up in a
single row. Is this possible?

For example
Author Name Book Titles
Author1 Book1, Book2, Book3

Author2 Book 4, Book7

I can get it so that it binds, but displays a separate row of each
Book name. Which is rubbish. I believe, as a alternative to my
desired result, I can create like a little nested gridview instead of
the Boot Titles column, which when click displays a list of titles.
Is this possible? Or did I just dream it? Any ideas how to show this
child data?

Thanks for any help regarding this?
cheers, Mike

From: Adrian Jones on
Try using a repeater control for your child data.
From: Guabble on
On Feb 5, 12:13 pm, Adrian Jones
<AdrianJo...(a)> wrote:
> Try using a repeater control for your child data.

How would that work, would I have to loop through the recordset rows,
grabbing the book title, concatenating them and outputting them.

Sorry i've never used a repeater before, from what I've read about
them, I thought they were mainly used to provide custom formatting to
grid cells.

Do you have any examples by any chance



From: Adrian Jones on
Hi Mike,

I'm a relative newbie to ASP.NET, so please excuse me if anything here is
done a bit back to front. But I've just used something like this to solve
something similiar to what you describe:

<!-- ==========================================
Gridview with repeater
========================================== -->

<asp:GridView ID="gvParent" runat="server"
OnRowDataBound="gvParent_RowDataBound" >
<asp:TemplateField HeaderText="Description">
<asp:Label ID="lblDescription" runat="server"
Text='<%# Eval("Description") %>' />
<asp:TemplateField HeaderText="Child Data ">
<asp:Repeater ID="rptChild" runat="server">
<asp:Label ID="lblChildDataField"
Text='<%# Eval("ChildDataField") %>'/>

<!-- =================================================
SQL sources for Parent and Child
================================================ -->

<asp:SqlDataSource ID="sqlChild" runat="server" ConnectionString="<%$
ConnectionStrings:connString %>"
SelectCommand="GetChildData" SelectCommandType="StoredProcedure">
<asp:ControlParameter ControlID="gvParent" Name="ParentID" Type="Int32" />
<asp:SqlDataSource ID="sqlParent" runat="server"
ConnectionString="<%$ ConnectionStrings:connString %>"
SelectCommand="GetParentData" SelectCommandType="StoredProcedure">

<-- In code-behind to databind each set of child data when parent is databound
================================================= -->

protected void gvParent_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
Repeater rep = (Repeater)e.Row.FindControl("rptChild");
string ID =
sqlChild.SelectParameters[0].DefaultValue = ID;
DataView dv = (DataView)sqlChild.Select
rep.DataSource = dv;

From: Guabble on
cheers dude, will try it out.... thanks heaps