我正在为我的大学开发一个自动结果表,我还附上了结果表的屏幕截图。我几乎能够使用gridview开发95%的结果表,现在我唯一的问题是我不知道如何为每列分配第二个标题。正如您在图像中看到的那样,有5个主题(P11MCA51,..,P11MCA55),每个主题有6个字段(C,S,T,CR,GP,GR)。从下面的代码我已经开发直到主题代码,但我卡住,因为我不知道如何插入这6个字段。
<pre>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Height="3px"
Width="550px" Visible="True">
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
<Columns>
<asp:BoundField DataField="USN" HeaderText="Usn" SortExpression="USN" ReadOnly = "true"/>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" ReadOnly = "true"/>
<asp:TemplateField HeaderText="P11MCA41" ItemStyle-Width="200px">
<ItemTemplate>
<asp:TextBox ID="C" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="S" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="T" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="CR" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="GP" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="GR" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="P11MCA42" ItemStyle-Width="200px">
<ItemTemplate>
<asp:TextBox ID="C" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="S" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="T" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="CR" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="GP" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
<asp:TextBox ID="GR" runat="server" Width = "30px" ReadOnly = "true" Text='<%# Eval("T1") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BorderColor="#660033" />
<RowStyle BackColor="#CCFFCC" BorderColor="#6600FF" BorderStyle="Double" />
</asp:GridView>
</pre>