日期:2014-05-18  浏览次数:20494 次

Gridview绑定到数组g,删除一行如何实现?
删除效果没出来?
public partial class _Default : System.Web.UI.Page 

  int m; 
  protected void Page_Load(object sender, EventArgs e) 
  { 
  string[] g = new string[4]; 
  g[0] = "aa"; 
  g[1] = "bb"; 
  g[2] = "cc"; 
  g[3] = "dd"; 
  GridView1.DataSource = g; 
  GridView1.DataBind(); 
  if(!this.IsPostBack) 
  m = 3; 
  } 
  protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
  {
  GridViewRow row = GridView1.Rows[e.RowIndex];
  Label1.Text = row.Cells[2].Text;
  }

------解决方案--------------------
探讨
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = GridView1.Rows[e.RowIndex];
Label1.Text = row.Cells[2].Text; //Label1是?这样怎么实现删除?
}
此外,你的数组已经固定了,每次Page_Load的时候都重新绑定一次GridView1,怎么可能变?