These three question can not say in a word.
1.Use DataGrid Itemplate to solve it.
2.Use ViewState or Session or Cache to maintain it.
3.Use Js script to visit all DataItem and make it work.

解决方案 »

  1.   

    TO:Jackyhx有没有代码?能不能贴出来给我?
    还有,为什么不能加到300分?
      

  2.   

    搜索一下,以前都讨论过
    你要等级达到4个▲才能放200分,300分要高级用户才能放,详细情况可以看csdn帮助
      

  3.   

    because your level is not enough to give 300 score.
    and Now I only can provide 200 to one post.
      

  4.   

    在PageIndexChanged事件中把当前页选择结果保存到dataset不就可以了吗.
      

  5.   

    1.
    CheckBox mycheck=new CheckBox();
    DataGrid.Items[行号].Cells[列号].Controls.Add(mycheck)以上代码您可以放在DataGrid的 ItemDataBound事件中2,3代码比较繁琐,我就不写了。
      

  6.   

    大家帮忙呀,我所有ASP的贴子都结贴呀,不会言而无信呀!
    我已经另外再开了一百分来给呀!
    你们可以查:
    http://expert.csdn.net/Expert/topic/1229/1229008.xml?temp=.6768915
      

  7.   

    continue:
    for exp:
    private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    CheckBox mycheck=new CheckBox();
    e.Item.Cells["calculateColumn"].Controls.Add(mycheck)
    }
      

  8.   

    TO:Jackyhx(一杯红茶,几句实话)
    请到这里领分!
    谢谢你帮我!http://expert.csdn.net/Expert/topic/1229/1229098.xml?temp=.1082117
      

  9.   

    我做过一个类似的程序,我在DataGrid中有两列,第一列绑定USERS表的USER_ID,第二列是个模板列,模板列中放一个DataList控件,在DataList的Itemtemplate中我放的是checkBox控件,绑定SP表的SP_NAME,我有三个自定义函数:loadData(),BindGrid(),SaveData();代码如下:
    private void LoadData()
    {
    //调用接口
    string CustUrl = System.Configuration.ConfigurationSettings.AppSettings["CustObjURL"];
    ICustomer customer = (ICustomer)Activator.GetObject(typeof(ICustomer), CustUrl);
    //登录ticket
    FormsAuthenticationTicket ticket=((FormsIdentity)User.Identity).Ticket;
    string userID=ticket.UserData;
    //得到此用户的CUST_ID
    customer.GetUser(userID,ref customerDS);
    CustomerDataset.USERSRow userRow=(CustomerDataset.USERSRow)customerDS.USERS.Rows[0];
    string custID=userRow.CUST_ID;
    customer.GetUserSP(custID,ref customerDS);
    //将customerDS存到Session中
    Session["Hoten.Boss.CustInfoSys.Web.custinfo.serviceinfo.customerDS"] = customerDS;
    }----------------------------------
    private void BindGrid()
    {
    //从Session中得到customerDS
    customerDS = (CustomerDataset)Session["Hoten.Boss.CustInfoSys.Web.custinfo.serviceinfo.customerDS"];
    dataGridUserSP.DataBind();
    int i;
    for (i = dataGridUserSP.CurrentPageIndex * dataGridUserSP.PageSize;
    i < (dataGridUserSP.CurrentPageIndex+1) * dataGridUserSP.PageSize && i < customerDS.USERS.Count;
    i++)
    {
    DataGridItem rowItem = dataGridUserSP.Items[i%dataGridUserSP.PageSize];
    string userID = customerDS.USERS[i].USER_ID;
    DataList dataList = (DataList)rowItem.FindControl("DataList1");
    foreach (DataListItem colItem in dataList.Items)
    {
    string spID = customerDS.SP[colItem.ItemIndex].SP_ID;
    CheckBox check = (CheckBox)colItem.FindControl("CheckBox2");
    //如果使用此SP,置相应checked为true,forecolor为red
    check.Checked = customerDS.USER_SP.FindByUSER_IDSP_ID(userID, spID) != null;
    check.ForeColor = customerDS.USER_SP.FindByUSER_IDSP_ID(userID, spID) != null? Color.Red : Color.Black;
    }
    }
    }------------------------------------------------------------------
    private void SaveData()
    {
    customerDS = (CustomerDataset)Session["Hoten.Boss.CustInfoSys.Web.custinfo.serviceinfo.customerDS"];
    int i;
    for (i = dataGridUserSP.CurrentPageIndex * dataGridUserSP.PageSize;
    i < (dataGridUserSP.CurrentPageIndex+1) * dataGridUserSP.PageSize && i < customerDS.USERS.Count;
    i++)
    {
    DataGridItem rowItem = dataGridUserSP.Items[i%dataGridUserSP.PageSize];
    string userID = customerDS.USERS[i].USER_ID;
    DataList dataList = (DataList)rowItem.FindControl("DataList1");
    foreach (DataListItem colItem in dataList.Items)
    {
    string spID=customerDS.SP[colItem.ItemIndex].SP_ID;
    CheckBox check=(CheckBox)colItem.FindControl("CheckBox2");
    //
    if((check.Checked) && (check.ForeColor==Color.Black))
    {
    customerDS.USER_SP.AddUSER_SPRow(userID, spID);
    }
    //
    if((check.Checked==false) && (check.ForeColor==Color.Red))
    {
    customerDS.USER_SP.FindByUSER_IDSP_ID(userID, spID).Delete();
    }
    }
    }
    }//说明一点,如果进来的时候,该CheckBox就是选中的,我把它显示为红色!这样,第二次处理的时候,如果看到红色的就不做处理!!你想在殿“上一页”,“下一页”的时候保存,这样就行了:
    private void dgUserSP_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    {
    SaveData();
    dataGridUserSP.CurrentPageIndex=e.NewPageIndex;
    BindGrid();
    }
    希望能对你有些帮助!!:)
      

  10.   

    谢谢kinglht(爱新觉罗至尊宝) 
    今天我去试试!
    可以的话我就结贴(二百分)!