Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a gridview in which when i click the select command button what should happen is it should allow me to fetch a column value to be added in my sql query to fill another gridview


SQL
select distinct a.*,b.active  from ranu.desgmaster a, tt.employees b where (b.active= 'T')   and a.desgid = b.desgid and a.MinLeavApp <= 1 and a.MaxLeavApp >= 1 order by Designation <pre lang="sql">and desiglevel < (select DesigLevel from ranu.desgmaster where b.empdesignation =''



here the b.empdesignation will come from the upper gridview
Posted

1 solution

Hi,

Just add DataKeyNames="Reference" to your first GridView,

Then in the linked SqlDataSource of the second GridView, get the selected value

XML
<SelectParameters>
    <asp:ControlParameter ControlID="GridView1" Name="Reference"
        PropertyName="SelectedValue" />
</SelectParameters>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900