ASP.NET GridView RowIndex 作为 CommandArgument [英] ASP.NET GridView RowIndex As CommandArgument

查看:14
本文介绍了ASP.NET GridView RowIndex 作为 CommandArgument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问和显示 gridview 项的行索引作为 buttonfield 列按钮中的命令参数?

How can you access and display the row index of a gridview item as the command argument in a buttonfield column button?

<gridview>
<Columns>
   <asp:ButtonField  ButtonType="Button" 
        CommandName="Edit" Text="Edit" Visible="True" 
        CommandArgument=" ? ? ? " />
.....

推荐答案

这里有一个很简单的方法:

Here is a very simple way:

<asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" Visible="True" 
                 CommandArgument='<%# Container.DataItemIndex %>' />

这篇关于ASP.NET GridView RowIndex 作为 CommandArgument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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