用datalist最好 只要設repeatcolumns就可

解决方案 »

  1.   

    在DATAGRID里加模板列,然后往模板列里添加TABLE,然后在TABLE的<TR><TD>里再绑定!可以实现你的要求!
      

  2.   

    取出所有id,在当前DataSet中新建Table,构造id1,id2字段,将原来的id存入,然后绑定新的Table(或者使用数组或数组接口)
      

  3.   

    objDataAdapter.Fill(ds,"Tmp_Pic");
    int j=0;
    for(int i=0;i<ds.Tables["Pic_View"].Rows.Count;i++){
    if(i%4==0){
    j=j+1;
    }
    if(1%4==1){
    ds.Tables["Tmp_Pic"].Rows[j].["id1"]=ds.Tables["Pic_View"].Rows[i].["id"];
    ds.Tables["Tmp_Pic"].Rows[j].["cate1"]=ds.Tables["Pic_View"].Rows[i].["CATEGORY"];
    }
    if(1%4==2){
    ds.Tables["Tmp_Pic"].Rows[j].["id2"]=ds.Tables["Pic_View"].Rows[i].["id"];
    ds.Tables["Tmp_Pic"].Rows[j].["cate2"]=ds.Tables["Pic_View"].Rows[i].["CATEGORY"];
    }
    if(1%4==3){
    ds.Tables["Tmp_Pic"].Rows[j].["id3"]=ds.Tables["Pic_View"].Rows[i].["id"];
    ds.Tables["Tmp_Pic"].Rows[j].["cate3"]=ds.Tables["Pic_View"].Rows[i].["CATEGORY"];
    }
    if(1%4==4){
    ds.Tables["Tmp_Pic"].Rows[j].["id4"]=ds.Tables["Pic_View"].Rows[i].["id"];
    ds.Tables["Tmp_Pic"].Rows[j].["cate4"]=ds.Tables["Pic_View"].Rows[i].["CATEGORY"];
    }
    }
    DataView dv = new DataView(ds.Tables["Tmp_Pic"]);
    return dv;老是报CS1001: 应输入标识符