Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gridview header vs label

Status
Not open for further replies.

Dimitrie1

Programmer
Jan 5, 2007
138
CA
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>
 
forgot to mention - I want to keep the current column headers too - I just want too much eh!(actually not me the users)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top