Reputation: 29789
Ive got my main table lets say with users and second with orders details. Now lets say that PK in users table is ID. In orders I have only card number column by which I can decide which rows should be displayed. In each row of users CardNumber Is as well.
I know how to create dataSource for Orders table which uses control parameter:
<asp:ControlParameter ControlID="gvUsers" DefaultValue="0" Name="ID"
PropertyName="SelectedValue" Type="Int32" />
Thanks to that I can get userId which is PK of the Users table and use it in the select query for orders. But I need to use not userId but CardID.
What should I do to make it the easiest way to rebind orders table everytime selected row i users table is changed based on the cardNumber value of newly selected row from users table.
Thanks for any help
Upvotes: 1
Views: 2097
Reputation: 29789
ok Ive figured it out.
It is enough to add key to <MasterTableView DataKeyNames="id, userId
And then You can use it in sql data source:
<asp:ControlParameter ControlID="gvUsers" DefaultValue="0" Name="userId"
PropertyName="SelectedValue" Type="Int32" />
Upvotes: 1