如何使用gridview行的值来填充另一个gridview? [英] how to use the value of gridview row to populate another gridview?

查看:63
本文介绍了如何使用gridview行的值来填充另一个gridview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview,当我点击选择命令按钮时应该发生的是它应该允许我获取一个列值,以便在我的sql查询中添加以填充另一个gridview





 选择  distinct  a。*,b.active 来自 ranu.desgmaster a,tt.employees b 其中(b .active = '  T' a.desgid = b.desgid  a.MinLeavApp< =  1   a.MaxLeavApp> =  1  订单  by 名称< pre lang =   sql>和desiglevel < (选择 DesigLevel 来自 ranu.desgmaster 其中 b.empdesignation = ' ' 







这里b.empdesignation将来自上层gridview

解决方案





只需将DataKeyNames =Reference添加到您的第一个GridView,



然后在第二个GridView的链接SqlDataSource中,获取所选值



 <   SelectParameters  >  
< asp:ControlParameter ControlID = GridView1 名称 = 参考

PropertyName = SelectedValue / >
< / SelectParameters >


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


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

解决方案

Hi,

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

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

<SelectParameters>
    <asp:ControlParameter ControlID="GridView1" Name="Reference"

        PropertyName="SelectedValue" />
</SelectParameters>


这篇关于如何使用gridview行的值来填充另一个gridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆