gridview
我在单击时调用的每一行都有一个删除按钮gvSiteInfo_RowDeleting(object sender, EventArgs e)
。如何找出单击的删除按钮的行号值?我需要在我指定的删除方法中有行号<< NEED ROW NUMBER HERE!! >>
到目前为止,我无法在网上搜索到任何东西,当我打印出的值时sender
,e
它们并没有告诉我任何有用的信息。
protected void gvSiteInfo_RowDeleting(object sender, EventArgs e)
{
SiteDB site = new SiteDB();
site.SelectedConnectionString = "SQLDEV08";
site.deleteSite(<<<NEED ROW NUMBER HERE!!>>>);
}
<asp:GridView ID="gvSiteInfo" runat="server" AutoGenerateColumns="False" OnSorting="gvSiteInfo_Sorting" width="100%"
AllowSorting="True" OnRowDeleting="gvSiteInfo_RowDeleting" >
<Columns>
<asp:CommandField ButtonType="Button" ShowDeleteButton="True" ShowCancelButton="True" />
<asp:BoundField DataField="prodServer" HeaderText="Production Server"
SortExpression="prodServer" />
<asp:BoundField DataField="prodIP" HeaderText="Production IP Address"
SortExpression="prodIP" />
<asp:BoundField DataField="Priority" HeaderText="Priority"
SortExpression="Priority" />
<asp:BoundField DataField="Platform" HeaderText="Platform"
SortExpression="Platform" />
</Columns>
</asp:GridView>