Hi,
with the code below I want to use one gridview in another to show a master-detail-relation.
Whe I run the script I see only the first GridView but not the second.
Can someone tell me what to do to get both, please.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ShowHeader="False" CellPadding="2" GridLines="None" datakeynames="category_guid">
<Columns>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "category")%>'></asp:Label>
<ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
</ItemTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" ShowHeader="False" CellPadding="2" GridLines="None" datakeynames="category_guid">
<Columns>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("date_start", "{0:dd.MM.yy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<a href="javascriptpenPopup('EventsPopup.aspx?guid=<%# Eval("event_guid") %>', '600', '465', 'events_details')"><%# Eval("title") %></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:FHBConnectionString %>"
SelectCommand="SELECT [web_event_categories].[category], [web_events].[event_guid], [web_events].[date_start], [web_events].[title] FROM [web_event_categories], [web_events] WHERE (([web_events].[date_start] > getdate()) AND ([web_events].[hide] = 0) AND ([web_events].[category_guid] = [web_event_categories].[category_guid]) AND [web_event_categories].[category_guid] = @kategorie) ORDER BY [web_event_categories].[category] ASC, [web_events].[date_start] ASC">
<SelectParameters>
<asp:ControlParameter Name="kategorie" ControlId="GridView1" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FHBConnectionString %>"
SelectCommand="SELECT [category_guid], [category] FROM [WEB_EVENT_CATEGORIES]">
</asp:SqlDataSource>
(
Ther result should look about somethilg like that:
HEADER
DETAIL
DETAIL
HEADER
DETAIL
DETAIL
DETAIL
)
With kind regards,
David
with the code below I want to use one gridview in another to show a master-detail-relation.
Whe I run the script I see only the first GridView but not the second.
Can someone tell me what to do to get both, please.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ShowHeader="False" CellPadding="2" GridLines="None" datakeynames="category_guid">
<Columns>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "category")%>'></asp:Label>
<ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
</ItemTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" ShowHeader="False" CellPadding="2" GridLines="None" datakeynames="category_guid">
<Columns>
<asp:TemplateField ShowHeader="False" SortExpression="date_start">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("date_start", "{0:dd.MM.yy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<a href="javascriptpenPopup('EventsPopup.aspx?guid=<%# Eval("event_guid") %>', '600', '465', 'events_details')"><%# Eval("title") %></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:FHBConnectionString %>"
SelectCommand="SELECT [web_event_categories].[category], [web_events].[event_guid], [web_events].[date_start], [web_events].[title] FROM [web_event_categories], [web_events] WHERE (([web_events].[date_start] > getdate()) AND ([web_events].[hide] = 0) AND ([web_events].[category_guid] = [web_event_categories].[category_guid]) AND [web_event_categories].[category_guid] = @kategorie) ORDER BY [web_event_categories].[category] ASC, [web_events].[date_start] ASC">
<SelectParameters>
<asp:ControlParameter Name="kategorie" ControlId="GridView1" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FHBConnectionString %>"
SelectCommand="SELECT [category_guid], [category] FROM [WEB_EVENT_CATEGORIES]">
</asp:SqlDataSource>
(
Ther result should look about somethilg like that:
HEADER
DETAIL
DETAIL
HEADER
DETAIL
DETAIL
DETAIL
)
With kind regards,
David