I have a gridview and want to add a header row that goes across the whole grid. I didn't think this was possible so I inserted a label on top of the grid. This works well accept I want the label to have a border and be the same width as the gridview - problem is the gridview varies in width based on data. Is there a better way?
Code:
<asp:Label ID="Label14" runat="server" BorderColor="#5D7B9D" BorderStyle="Solid"
BorderWidth="1px" CssClass="subTitle" Style="position: static" Text="Inventory"
Width="437px"></asp:Label>
<asp:GridView ID="GridView2" runat="server" DataKeyNames="Range_ID" DataSourceID="dsRange"
AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True">
<Columns>
<asp:BoundField DataField="Range_ID" HeaderText="Range_ID" SortExpression="Range_ID" Visible="False" />
<asp:BoundField DataField="Start" HeaderText="First Serial " SortExpression="Start" />
<asp:BoundField DataField="Stop" HeaderText="Last Serial " SortExpression="Stop" />
<asp:BoundField DataField="Amount" HeaderText="Quantity" SortExpression="Amount" />
<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
<asp:BoundField DataField="Category" HeaderText="Category" SortExpression="Category" />
<asp:BoundField DataField="Validity_Period" HeaderText="Validity Period" SortExpression="Validity_Period" />
<asp:BoundField DataField="Name" HeaderText="Owner" SortExpression="Name" Visible="False" />
<asp:BoundField DataField="Total" ReadOnly="True" ShowHeader="False">
<ItemStyle CssClass="none" />
<HeaderStyle CssClass="none" />
<FooterStyle CssClass="none" />
</asp:BoundField>
</Columns>
<FooterStyle BorderStyle="Solid" />
</asp:GridView>