با سلام
اگر در یک صفحه هستند به این شکل
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CategoryID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" ReadOnly="True"
SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName" HeaderText="CategoryName"
SortExpression="CategoryName" />
<asp:HyperLinkField DataNavigateUrlFields="CategoryID"
DataNavigateUrlFormatString="?CategoryID={0}" HeaderText="انتخاب"
Text="انتخاب" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>"
SelectCommand="SELECT [CategoryID], [CategoryName], [CategoryPosition] FROM [B_Categories]">
</asp:SqlDataSource>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataKeyNames="ForumID" DataSourceID="SqlDataSource2"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="ForumID" HeaderText="ForumID" ReadOnly="True"
SortExpression="ForumID" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
SortExpression="CategoryID" />
<asp:BoundField DataField="ForumName" HeaderText="ForumName"
SortExpression="ForumName" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>"
SelectCommand="SELECT [ForumID], [CategoryID], [ForumName], [ForumDescription], [ForumPosition] FROM [B_Forums] WHERE ([CategoryID] = @CategoryID)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="CategoryID"
QueryStringField="CategoryID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
اگر در یک صفحه دیگر است
با فرستادن id میتوان نمایش داد