extaspnet中grid全选批量删除的问题
我给grid的pagesize设置为3,然后删除事件的代码如下
protected void btnDelete_Click(object sender, EventArgs e)
{
try
{
int m = 0;
string sql = "Id in (";
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int row in Grid1.SelectedRowIndexArray)
{
if (m > 0)
{
sql += ",";
}
sql += Grid1.DataKeys[row][0].ToString();
m = m + 1;
}
sql += ")";
if (cbll.Delete(sql))
{
Grid1.SelectedRowIndexArray = null;