如何在asp.net中获取子gridview链接按钮值 [英] How to get child gridview link button value in asp.net

查看:71
本文介绍了如何在asp.net中获取子gridview链接按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在另一个gridview中有一个gridview。如何获取子gridview的单元格值链接按钮。



< asp:gridview id =MasterGridrunat =Server>

< asp:模板字段>

< asp:label id =lbl1runat =server>

br mode =hold/ >

< asp:模板字段>

< asp:gridview id =ChildGridrunat =Server>

< asp:LinkBut​​ton ID =lnkPurchaserunat =serverCausesValidation =falseToolTip =查看/>



br mode =hold />

解决方案





试试这个



  Dim  grdM  As  GridView =  DirectCast (repeaterView1.FindControl(  MasterGrid),GridView)
对于 每个 rowM 作为 GridViewRow grdM。行
Dim grdC As GridView = DirectCast (rowM .Cells( 0 ) .FindControl( ChildGrid),GridView)
对于 每个 rowC 作为 GridViewRow In grdC。行

Dim lnkPurchase As LinkBut​​ton = DirectCast (rowC.FindControl( lnkPurchase) ,LinkBut​​ton)
下一步
下一步


I have a gridview inside another gridview. How to get cell value link button of the child gridview.

<asp:gridview id="MasterGrid" runat="Server">
<asp:Template Field>
<asp:label id="lbl1" runat="server">
br mode="hold" />
<asp:Template Field>
<asp:gridview id="ChildGrid" runat="Server">
<asp:LinkButton ID="lnkPurchase" runat="server" CausesValidation="false" ToolTip="View"/>

br mode="hold" />

解决方案

hi,

try this

Dim grdM As GridView = DirectCast(repeaterView1.FindControl("MasterGrid"), GridView)
  For Each rowM As GridViewRow In grdM .Rows
    Dim grdC As GridView = DirectCast(rowM .Cells(0).FindControl("ChildGrid"),    GridView)
 For Each rowC As GridViewRow In grdC .Rows

Dim lnkPurchase  As LinkButton = DirectCast(rowC.FindControl("lnkPurchase "), LinkButton)
     Next
  Next


这篇关于如何在asp.net中获取子gridview链接按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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