GridView中里面需要最末一行加入统计行,请问GridView是不是能实现这样的功能?
在绑定列后面加入
<thead class="data_th_total">
   <tr>
       <td colspan="13"><span class="titletd_data">采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元</span>
       </td>
   </tr>
</thead>

解决方案 »

  1.   

    加入GridView的页脚里显示就行
      

  2.   

    可以在页尾加模版列做成与数据项一样的格式作为显示统计。
    如果没有分页的话,在GridView后面加个表格也可以吧?
      

  3.   

    参考http://book.csdn.net/bookfiles/73/100732072.shtml
      

  4.   

    ShowFooter
     指示是否显示页脚行。
     
    ShowHeader
     指示是否显示标题行
    将属性设置一下,你就可以在你所要的模块里编辑了~
     
      

  5.   

    因为这一行又特殊的样式
    <thead   class="data_th_total"> 
          <tr> 
    所以比较难办
      

  6.   

    放页脚里
    可以用GridView.FooterRow 对页脚进行设置
      

  7.   

    设置FooterStyle
    要还是不行,考虑放在另一个紧邻GridView的table里
      

  8.   

    可以使用页脚 可那位可以把
    <thead   class="data_th_total"> 
          <tr> 
                  <td   colspan="13"> <span   class="titletd_data"> 采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元 </span> 
                  </td> 
          </tr> 
    </thead> 中的<thead   class="data_th_total"> 标签放入页脚中 我把分都给他
      

  9.   

    可以 用模板列,然后在模板列里使用特殊样式 data_th_total
      

  10.   

    <thead       class="data_th_total"> 这个标签是美工定义的,只有使用这个标签以后才能达到美工的效果,哪位可以?
      

  11.   

    <thead       class="data_th_total">   
                <tr>   
                                <td       colspan="13">   <span       class="titletd_data">   采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元   </span>   
                                </td>   
                </tr>   
    </thead>   

    至少要有<table></table>包围.
    <table><thead       class="data_th_total">   
                <tr>   
                                <td       colspan="13">   <span       class="titletd_data">   采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元   </span>   
                                </td>   
                </tr>   
    </thead>
    </table>
    再说不明白你是什么意思,你要个thead有什么用,是有特定css么,这样的话,你用其它元素替换,只要设置类相同就可以了.
      

  12.   

    Note: If you use the thead, tfoot and tbody elements, you must use every element. They should appear in this order: <thead>, <tfoot> and <tbody>, so that browsers can render the foot before receiving all the data. You must use these tags within the table element.Note: The <thead>,<tbody> and <tfoot> elements are seldom used, because of bad browser support. Expect this to change in future versions of XHTML. If you have Internet Explorer 5.0 or newer, you can view an example in our XML tutorial.不知楼主要干什么,加个页脚你可以自定义格式啊
    到底想做什么???
      

  13.   

    其他的行是普通的tr 也就是DataGrid的普通绑定行
    而><thead       class="data_th_total">   
                <tr>   
                                <td       colspan="13">   <span       class="titletd_data">   采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元   </span>   
                                </td>   
                </tr>   
    </thead>
    是一个用来统计用的,他有其自身的样式,并且在DataGrid生成以后会是这个样子
    <tr>
    <td>
    ......
    </td>
    </tr>
    <thead       class="data_th_total">   
                <tr>   
                                <td       colspan="13">   <span       class="titletd_data">   采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元   </span>   
                                </td>   
                </tr>   
    </thead>
    这一统计行中需要在tr外面加入<thead       class="data_th_total">   
    不知道我说的清楚不。
      

  14.   

    套用样式,只有类引用相同就可以了,然后在css中
    .data_th_total{
    }
      

  15.   

    那个标签必须有 否则出不来美工的效果
    而且统计行必须作为GridView其中一行才行
      

  16.   

    美工的静态页面例子
    <tr>
    <td>10</td>
    <td>南京市玄武区锁金村卫生服务中心</td>
    <td>江宁采购中心</td>
    <td><span class="titletd_data">44</span></td>
    <td><span class="titletd_data">9939.15</span></td>
    <td><span class="titletd_data">&nbsp;</span></td>
    <td><span class="titletd_data">7370.50</span></td>
    <td><span class="titletd_data">3646.10</span></td>
    <td><span class="titletd_data">&nbsp;</span></td>
    <td><span class="titletd_data">&nbsp;</span></td>
    <td><span class="titletd_data">100.00</span></td>
    <td><span class="titletd_data">100.00</span></td>
    <td><span class="titletd_data">100.00</span></td>
    <td><input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'" onclick="location='hos_und.html'" value="订单明细" /></td>
    </tr>
    </tbody>
    <thead class="data_th_total">
    <tr>
    <td colspan="14"><span class="titletd_data">采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元</span></td>
    </tr>
    </thead>
      

  17.   

    css粘出来看看,什么效果啊?
      

  18.   

    用DataTable的NewRow方法,直接把统计结果放在最后一行
    private void bindCharge()
        {
            DataTable tb = new GroupChargeBalance().GroupDayChargeInfo(Convert.ToInt32(ViewState["GroupID"]));
            if (tb.Rows.Count >= 1)
            {
                decimal fCharge, rCharge, sCharge, reCharge, oCharge, cCharge, tCharge;
                fCharge = rCharge = sCharge = reCharge = oCharge = cCharge = tCharge = 0;
                int count = tb.Rows.Count;
                for (int i = 0; i<count; i ++)
                {
                    fCharge += Convert.ToDecimal(tb.Rows[i]["FoodCharge"]);
                    rCharge += Convert.ToDecimal(tb.Rows[i]["RoomCharge"]);
                    sCharge += Convert.ToDecimal(tb.Rows[i]["TicktCharge"]);
                    reCharge += Convert.ToDecimal(tb.Rows[i]["RecieptionCharge"]);
                    cCharge += Convert.ToDecimal(tb.Rows[i]["TrafficCharge"]);
                    oCharge += Convert.ToDecimal(tb.Rows[i]["OtherCharge"]);
                    tCharge += Convert.ToDecimal(tb.Rows[i]["Total"]);
                }
                DataRow row = tb.NewRow();
                row["FoodCharge"] = fCharge;
                row["RoomCharge"] = rCharge;
                row["TicktCharge"] = sCharge;
                row["RecieptionCharge"] = reCharge;
                row["TrafficCharge"] = cCharge;
                row["OtherCharge"] = oCharge;
                row["Total"] = tCharge;
                row["ID"] = 0;
                tb.Rows.Add(row);
            }
            GridView1.DataSource = tb;
            GridView1.DataBind();
            if (GridView1.Rows.Count > 0)
            {
                GridView1.Rows[GridView1.Rows.Count - 1].Cells[GridView1.Columns.Count - 1].Text = "";
            }
        }
      

  19.   

    可以,new一个row就成,lz就是例子
      

  20.   

    对了,datagridview嵌套可以实现
      

  21.   

    为什么回答的人没有看到 
    统计行tr外面还有
    <thead   class="data_th_total"> 
    标签 
    如何把这个标签放到统计行的外面,这才是如何解决的办法
      

  22.   

    .data_th_total {
    height:22px;background:url(../_images/t_bg.gif);
    }
    .data_th_total tr {
    background-color: #9cb0cb;height:22px!important;white-space:nowrap;text-align:center;
    }
    /*数据表格居右属性*/
    .titletd_data {
    float:right;
    padding-left:3px;
    padding-right:3px;
    }/*数据表格居左属性*/
    .titletd_data_left {
    float:left;
    padding-left:3px;
    padding-right:3px;
    }
      

  23.   

    哦,你是想加个背景图呀,可以的,你把元素改一下就行了,css如果你懂得话,很容易实现.
    很简单的.还是照我说的那种方法,只要把里面的CLASS设置对应的匹配就可以了...
      

  24.   

    我觉得属性框里有CSS栏吧,你点浏览,引用这个CSS也行.
    实在不行,你先看看生成的HTML源文件,然后看看其继承关系.CSS就好写了.
      

  25.   

    参考这里.我以前用过的.我的bloghttp://shoubinansan.blog.163.com/blog/static/19512282007721144253/
    记着给分!分!分!分!分!分!分!分!分!
      

  26.   

    我现在只想生成以后会出现这样的一行<thead       class="data_th_total">   
                <tr>   
                                <td       colspan="13">   <span       class="titletd_data">   采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元   </span>   
                                </td>   
                </tr>   
    </thead>难道不可以吗?
      

  27.   

    http://bbs.blueidea.com/thread-2658231-1-1.html
    lz,你要写table的啊,还有thead要在tr里的啊,早就说过了...
      

  28.   

    参考这里.我以前用过的.我的blog http://shoubinansan.blog.163.com/blog/static/19512282007721144253/ 
    这个只是用代码的方法写出来了.不就是要实现最后一行是统计吗?
    你参照一下就可以了.不是照搬!
      

  29.   

    你那个我早就知道 而且我还合并了
    因为这个统计需要加入样式 不仅仅是给tr添加样式 还需要在tr外面加入<thead class="data_th_total"> 标签 才会实现美工给出的效果
          
      

  30.   

    你看看我给你的网址啊,thead其实就相当于td.只不过写成thead让你知道是表头而已...
    <tr>
    <thead  class="data_th_total"> 
    </tr>      
    <tr>       
    <td  colspan="13">       <span  class="titletd_data">采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元</span>       
    </td>       
    </tr>       
    </thead> 
      

  31.   

    不好意思,上面写错了
    <tr> 
    <thead     class="data_th_total">xxxxx</thead>  
    </tr>
                 
    <tr>               
    <td     colspan="13">               <span     class="titletd_data"> 采购总金额:9939.15元&nbsp;&nbsp;&nbsp;配送总金额:7370.5元&nbsp;&nbsp;&nbsp;验收总金额:3646.1元 </span>               
    </td>               
    </tr>               
      

  32.   

    thead这个东东好象从来没用过,不知有什么不可替代的作用
      

  33.   

    see:http://dotnetjunkies.com/Article/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik
      

  34.   

    http://support.microsoft.com/kb/326339/zh-cn中文版
      

  35.   

    加入GridView的页脚里显示就行