且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C#在asp.net中获取gridview行值

更新时间:2023-12-06 15:57:46

嘿,简单的答案是使用LinkBut​​ton或任何其他按钮,并使用CommandName和CommandArgument属性并传递CommandArgument是传递给Tex时的当前单元格值t字段并使用该CommandArgument,您可以轻松获取当前单元格值。



Hey the simple answer is use LinkButton or any other buttons, and use CommandName and CommandArgument properties and pass CommandArgument is the current cell value as you pass to Text field and using that CommandArgument you can easily get the current cell value.

<ItemTemplate>
         <asp:LinkButton ID="lnkbtn" runat="server" Text='<%#Eval("ID")%>'

          CommandArgument=
          '<%#Eval("ID") %>'

              CommandName="Get" />
        </ItemTemplate>





和onrowcommand事件你可以通过传递commandname和commandargument来获取单元格值。



and onrowcommand event you can get the cell value by passing commandname and commandargument.