look this simple example i think it will help you
<asp:GridView
id="GridView1"
DataKeyNames="Id"
DataSourceID="srcGridView1"
AutoGenerateSelectButton="true"
SelectedRowStyle-CssClass="selectedRow"
Runat="server" />
<asp:GridView
id="GridView2"
DataSourceID="srcGridView2"
Runat="server" />
<asp:SqlDataSource
id="srcGridView1"
ConnectionString="<%$ ConnectionStrings:str1 %>"
SelectCommand="SELECT Id, Name FROM UrTable1"
Runat="server" />
<asp:SqlDataSource
id="srcGridView2"
ConnectionString="<%$ ConnectionStrings:str1 %>"
SelectCommand="SELECT FieldName1,FieldName2 FROM UrTable2
WHERE Id=@GridView1Id"
Runat="server">
<SelectParameters>
<asp:ControlParameter
Name="GridView1Id"
ControlID="GridView1"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>