dingir
asked on
Put a repeater inside a gridview
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" EnableSortingAndPagingCall backs="tru e" 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, LinqDataSourceSelectEventA rgs e)
{
DataContext db = new DataContext();
e.Result = Class.GetItems(Current.Cla ss.Id.ToSt ring());
}
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
<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, LinqDataSourceSelectEventA
{
DataContext db = new DataContext();
e.Result = Class.GetItems(Current.Cla
}
please explain ur question little bit clearer
ASKER
Erhm i just want that way to populate the gridview to work..:)
Especially the inner gridview, the rest are of course working..
If I populate the inner gridview with an another datasource, how do I make it populated with each parent rowid as where statement?
Especially the inner gridview, the rest are of course working..
If I populate the inner gridview with an another datasource, how do I make it populated with each parent rowid as where statement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank's for help..
I have tried this now and understand that I missunderstood some effects.
I want the subrows simply listed below the parent row. One line per match.
With this code, the subgridview (of course) apperars as an extra field.
Second,
The subrows are loaded with an own datasourceid, how do i put the correct parentrow as a parameter for that datasourceid? I need to put it code file because the data set are loaded from a class object..
protected void BoundGv2(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
((System.Web.UI.WebControl s.GridView )e.Row.Fin dControl(" gv2")).Dat aBind();
}
protected void ds2_Selecting(object sender, LinqDataSourceSelectEventA rgs e)
{
DataContext db = new DataContext();
e.Result = Namespace.Core.GetRows(par entrowid);
}
I have tried this now and understand that I missunderstood some effects.
I want the subrows simply listed below the parent row. One line per match.
With this code, the subgridview (of course) apperars as an extra field.
Second,
The subrows are loaded with an own datasourceid, how do i put the correct parentrow as a parameter for that datasourceid? I need to put it code file because the data set are loaded from a class object..
protected void BoundGv2(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow
((System.Web.UI.WebControl
}
protected void ds2_Selecting(object sender, LinqDataSourceSelectEventA
{
DataContext db = new DataContext();
e.Result = Namespace.Core.GetRows(par
}
i am not able to get ur Question.please explain little bit cleare with an example
ASKER
the result of the gridviews should be viewed as
Item 1 field1 field2
Choosen Option 1 price
Choosen Option color red
Choosen Option size 3
Item 2 field1 field2
Choosen Option 1 price 40$
Choosen Option color red
Choosen Option size 1
and so on,
Item 1 field1 field2
Choosen Option 1 price
Choosen Option color red
Choosen Option size 3
Item 2 field1 field2
Choosen Option 1 price 40$
Choosen Option color red
Choosen Option size 1
and so on,
u want to bind gridView2 based on value of GridView1 right? u wanna pass the value of particular column of gridview1 as a parameter to GridView2?
ASKER
That's correct,
And in my sample, gridview 2 needs to repeat the data for each parent row,
And in my sample, gridview 2 needs to repeat the data for each parent row,