在C#.NET中,当我编辑数据网格中的单元格(可能是CellEditEnd Event)时,如何获取我修改过的单元格的行号和列号?
答案 0 :(得分:0)
<asp:GridView ID="gvAll" runat="server"
AutoGenerateColumns = "false" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "green" AllowPaging ="true"
OnPageIndexChanging = "OnPaging" DataKeyNames = "CustomerID"
PageSize = "10" >
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkAll" runat="server"
onclick = "checkAll(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chk" runat="server"
onclick = "Check_Click(this)"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width = "150px" DataField = "ContactName"
HeaderText = "Contact Name"/>
<asp:BoundField ItemStyle-Width = "150px" DataField = "Country"
HeaderText = "Country"/>
<asp:BoundField ItemStyle-Width = "150px" DataField = "City"
HeaderText = "City"/>
</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
以下列方式在ASP.Net GridView的OnPageIndexChanging事件中调用SetData方法
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
gvAll.PageIndex = e.NewPageIndex;
gvAll.DataBind();
SetData();
}
此网址详细说明
http://www.aspsnippets.com/Articles/Select-and-delete-multiple-rows-in-ASP.Net-Gridview-control.aspx