Here is my code with a main gridView, SqlDataSource and a detailed gridView. The sqlDataSource contains two SelectParameters which are SelectedValues from the main gridView. When selecting a row in the main gridView the data in the detailed gridView is not retrieved. What am I doing wrong?? (it works OK with one select parameter).

    <asp:GridView ID="grvUserFiles" runat="Server" Font-Size="Small" AutoGenerateColumns="False"
        OnRowDeleting="UsersGridView_RowDeleting" OnRowDataBound="grvUserFiles_RowDataBound"
        DataSourceID="UsersDataSource" DataKeyNames="UserName,Dictionary">
        <SelectedRowStyle CssClass="SelectedRowStyle" />
        <Columns>
            <asp:BoundField HeaderText="User Name" DataField="UserName" SortExpression="UserName"
                ReadOnly="True" ItemStyle-Width="100"></asp:BoundField>
            <asp:BoundField HeaderText="Dictionary" DataField="Dictionary" SortExpression="Dictionary"
                ReadOnly="True" ItemStyle-Width="230"></asp:BoundField>
            <asp:CommandField ShowSelectButton="True" ButtonType="Button" SelectText="Files List"
                ControlStyle-CssClass="CssButton" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Button ID="ButtonDelete" Text="Delete" CommandArgument='<%# Eval("Dictionary")%>'
                        CommandName="Delete" runat="server" CssClass="CssButton"></asp:Button>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <asp:SqlDataSource ID="FilesDataSource" runat="server" SelectCommand="SELECT FileName, Status FROM UserFiles WHERE ((UserName = @UserName) AND (Dictionary = @Dictionary))"
        ConnectionString="<%$ ConnectionStrings:XmlEditor %>" 
        ProviderName="System.Data.SqlClient">
        <SelectParameters>
            <asp:ControlParameter ControlID="grvUserFiles" Name="UserName" 
                PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="grvUserFiles" Name="Dictionary" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="DetailsView1" runat="server" Font-Size="Small" DataSourceID="FilesDataSource"
        AutoGenerateRows="False" AutoGenerateColumns="False">
        <Columns>
            <asp:BoundField DataField="FileName" HeaderText="FileName" SortExpression="FileName"
                ItemStyle-Width="400" />
            <asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status"
                ItemStyle-HorizontalAlign="Center" />
        </Columns>
    </asp:GridView>
link|improve this question
Since there are two grid views, you would need two SQLDatasource, one for each. – The crocodile hunter Feb 21 at 4:22
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.