We help IT Professionals succeed at work.
Get Started

Put a repeater inside a gridview

dingir
dingir asked
on
402 Views
Last Modified: 2012-05-08
I'm about to put a repeater inside a gridview.

Below each row I want the list of all (to that row) related childrows.
Because I use ds_Selecting and get data to the gridview, i want to use this by asp.net.
Because of listing, sorting and so on..
Mostly of the samples i found are dousens of code file codes.

Some best pratice here?

So far I have this code to go from,

                <asp:GridView ID="gv" runat="server" Width="500px" AllowSorting="true" AllowPaging="false" PageSize="50"
                    AutoGenerateColumns="False"  DataSourceID="ds" EnableSortingAndPagingCallbacks="true" CellPadding="3" GridLines="None">
                    <Columns>
                        <asp:BoundField DataField="OrderItemId" ItemStyle-CssClass="hidden" />
                        <asp:BoundField DataField="Title" SortExpression="Title" ItemStyle-Width="230px" HeaderText="Title"  />
                        <asp:TemplateField>
                            <asp:GridView ID="gv2" DataSource="ds2" runat="server" AutoGenerateColumns="False">
                             <Columns>
                               <asp:BoundField DataField="Name" HeaderText="Name" />
                             </Columns>
                            </asp:GridView>
                        </asp:TemplateField>
                    </Columns>
                     <EmptyDataTemplate>
                     </EmptyDataTemplate>            
                </asp:GridView>

Codefile...

    protected void ds_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        DataContext db = new DataContext();
        e.Result = Class.GetItems(Current.Class.Id.ToString());
    }
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE