c# - 我只需要合并gridview中的特定列
问题描述
尊敬的观众我只需要一个特定的列不会在 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> (<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>
解决方案
您可以使用嵌套网格视图。这将为您提供您想要的完美结果。
推荐阅读
- javascript - 根据二维数组中的输入获取值
- oracle - ORA-01002: 在 oracle 中提取乱序
- regex - 键盘映射文件中的字符转义
- javascript - Ajax 调用返回用户错误:字符串长度超过 maxJsonLength 属性设置的值
- http - 为什么axios在发出请求时总是把https转成http?
- ios - 如何在不阻塞代码的情况下等待 BLE 回调
- android - 为什么我的应用程序从资源中获取错误字符串以进行本地化?
- python - pandas.read_csv y 轴包含整个数据行和 sklearn.linear 模型 ValueError
- python - 重复输入
- c# - 忽略空的 ComboBoxItems