我只需要合并gridview中的特定列

时间:2019-05-09 16:39:48

标签: c# asp.net gridview webforms

推荐的查看器我只需要在Gridview中一次又一次不重复,我在屏幕截图中附加了一个屏幕快照,您可以看到房间收费重复了3次,但是我只需要重复一次,然后其费用和日期就会显示在简单的语言是标题请查看

  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" Width="100%" BorderWidth="0px" BorderStyle="None" OnRowDataBound="GridView1_RowDataBound" ShowFooter="true" OnDataBound="GridView1_DataBound">
                      <Columns>

                         <asp:TemplateField HeaderStyle-BorderStyle="None" ItemStyle-BorderStyle="None" FooterStyle-BorderStyle="None" >

                             <ItemTemplate>

                                 <table style="width:100%;font-size:12px;text-align:left">
                                     <tr>
                                         <td colspan="5"> 
                                              <table style="width:100%;font-size:16px; font-weight:bold; font-family:Cambria, Cochin, Georgia, Times, Times New Roman, serif;text-align:left;margin-bottom:10px">
                                     <tr><td><u> <asp:Label ID="lblprintheading" runat="server" Text='<%#Eval("Headingname")%>' ></asp:Label></u>

                                         </td></tr>
                                 </table>
                                            </td>
                                     </tr>
                                     <tr>
                                         <td style="width:10%;">
                                             <asp:Label ID="lblservicedate" runat="server" Text='<%#Eval("Date")%>'></asp:Label>
                                         </td> <td style="width:50%;">
                 <asp:Label ID="lblparticular" runat="server" Text='<%#Eval("Servicename")%>'></asp:Label> &nbsp;(<asp:Label ID="Label22" runat="server" Text='<%#Eval("doctorname")%>'></asp:Label>)
              </td>
                <td style="width:10%;">
                   <asp:Label ID="lblrate" runat="server" Text='<%#Eval("Rate")%>'></asp:Label>
              </td>
                <td style="width:10%;">
                 <asp:Label ID="lblnos" runat="server" Text='<%#Eval("Qty")%>'></asp:Label>
              </td>
                 <td style="width:20%;">
                 <asp:Label ID="lblprice" runat="server" Text='<%#Eval("Nettotal")%>'></asp:Label>
              </td>
                                     </tr>


                                 </table>
                             </ItemTemplate>
                             <FooterTemplate >
                                  <table style="width:100%;text-align:center; border:0px none">
                                      <tr>
                                          <td colspan="5" style="text-align:right;padding-right:50px"> ..................................................................................</td>
                                      </tr>
                                      <tr>
                                           <td style="width:10%;">

                                         </td> <td style="width:50%;">

              </td>
                <td style="width:10%;">

              </td>
                                           <td style="width:10%; font-size:18px; font-weight:bold;">
                                                        Total:
                                                   </td>
                                          <td style="width:20%;">
                                              <asp:Label ID="Label18" runat="server" Text='<%#Eval("Nettotal")%>'></asp:Label>

                                          </td>
                                      </tr>
                                  </table>
                             </FooterTemplate>
                         </asp:TemplateField>

                      </Columns>
                  </asp:GridView>

https://i.stack.imgur.com/6Rl6K.png

1 个答案:

答案 0 :(得分:0)

您可以使用嵌套网格视图。这将为您提供理想的结果。