如题,大哥们帮忙,急!急!急!!!!

解决方案 »

  1.   

    .net以前做过
    在分页事件之前可以用ViewState保存选择的id,然后分页之后 之前判断是否有这个id,再来确定是否选中
      

  2.   

    保存CheckBox的值GridView在分页过程中并不维护CheckBox的选择状态,幸运的是,我们可以使用Session来维护CheckBox的状态, 这个功能使用RememberOldValues完成
    C# code 
    private void RememberOldValues(){ArrayList categoryIDList = new ArrayList();int index = -1;foreach (GridViewRow row in GridView1.Rows){   index = (int) GridView1.DataKeys[row.RowIndex].Value;   bool result = ((CheckBox)row.FindControl("CheckBox1")).Checked;
    // Check in the Sessionif (Session[CHECKED_ITEMS] != null)   categoryIDList = (ArrayList)Session[CHECKED_ITEMS];if (result){if (!categoryIDList.Contains(index))   categoryIDList.Add(index);}else   categoryIDList.Remove(index);}if (categoryIDList != null && categoryIDList.Count > 0)   Session[CHECKED_ITEMS] = categoryIDList;}还原CheckBox的状态下一步,需要定义一个方法来还原Checkbox的状态值C# code 
    private void RePopulateValues(){ArrayList categoryIDList = (ArrayList)Session[CHECKED_ITEMS];if (categoryIDList != null && categoryIDList.Count > 0){foreach (GridViewRow row in GridView1.Rows){   int index = (int)GridView1.DataKeys[row.RowIndex].Value;if (categoryIDList.Contains(index)){   CheckBox myCheckBox = (CheckBox) row.FindControl("CheckBox1");   myCheckBox.Checked = true;}}}}最后,在分页事件里调用上面两个方法
    C# code 
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e){RememberOldValues();GridView1.PageIndex = e.NewPageIndex;BindData();RePopulateValues();}
      

  3.   

    大哥们,用asp 如何实现?
      

  4.   

    告诉你个简单办法,页面创建一个label,用display:none属性,隐藏起来(这样js可以取到)。
    后面你就晓得了
      

  5.   

    做一个HashMap来记录选中的记录,放SESSION中