I have a GridView nested in DataList. Upon binding, the DataList generates a bunch of line items, each containing an instance of the GridView. Here's a code snipped:
<
asp:DataList ID="DataList1" runat="server" DataSourceID="CaseManagersDataSource" OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
<asp:GridView ID="gridViewWorkQueue" runat="server" DataSource='<%# Eval("WQCases") %>' OnSelectedIndexChanged="gridViewWorkQueue_SelectedIndexChanged">
<Columns>
<asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Icons/info_16.png" ShowSelectButton="True" CausesValidation="False" />
<asp:BoundField DataField="CaseGUID" HeaderText="CaseGUID" SortExpression="CaseGUID" Visible="False" />
<asp:BoundField DataField="BCDHSCaseNumber" HeaderText="Case #" SortExpression="BCDHSCaseNumber" NullDisplayText="<i>(missing Msg. 23-Q)</i>" />
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:DataList>
As you can see CommandField in the GridView is set to fire the "select" command - works as expected - gridViewWorkQueue_SelectedIndexChanged event handler is envoked on the post back.
My problem is that the "parent" DataList SelectedItem is null and SelectedIndex is -1.
I assume that's by design, since the "select" command initiated from the nested GridView.
My question is how to make the selection of a DataGrid row to also select the DataList row that contains that DataGrid.
I was thinking about using GridView's Parent...
Thanks!