2016-08-31 5 views
0

Können Sie mir bitte helfen, wie man die Kopfzeile von Gridview zeigt, wenn ich die Seite lade. Hier in meiner aspx Seite. Vielen Dank im VorausWie Gridview-Header auf PageLoad anzeigen?

<asp:GridView ID="grvProductInventory" runat="server" AutoGenerateColumns="False" ShowHeaderWhenEmpty="True" class="table-responsive table table-striped jambo_table bulk_action" CellPadding="4" ForeColor="#333333" GridLines="None"> 
         <EditRowStyle BackColor="#999999" /> 
         <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
         <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
         <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> 
         <Columns> 
          <asp:CommandField ShowDeleteButton="True" DeleteText="Remove" /> 
          <asp:BoundField HeaderText="Seller" DataField="pSeller"/> 
          <asp:BoundField HeaderText="Buyer " DataField="pBuyer"/> 
          <asp:BoundField HeaderText="QTY" DataField="pQTY" DataFormatString="{0:#,###0.000}"/> 
          <asp:BoundField HeaderText="Code" DataField="pCode" /> 
          <asp:BoundField HeaderText="Product" DataField="pProduct" /> 
          <asp:BoundField HeaderText="Date From" DataField="Date1" DataFormatString ="{0:dd/M/yyyy}" /> 
          <asp:BoundField HeaderText="Date To" DataField="Date2" DataFormatString ="{0:dd/M/yyyy}" /> 
          <asp:BoundField HeaderText="Total Days" DataField="TotalDays" /> 
          <asp:BoundField HeaderText="Pur Prem" DataField="pPurPremium" /> 
          <asp:BoundField HeaderText="Ave" DataField="Ave" DataFormatString="{0:#,###0.000}"/> 
          <asp:BoundField HeaderText="Net Price" DataField="NetPurPrice" DataFormatString="{0:#,###0.000}"/> 
          <asp:BoundField HeaderText="USD" DataField="USD" DataFormatString="{0:#,###0.000}"/> 
          <asp:BoundField HeaderText="AED" DataField="AED" DataFormatString="{0:#,###0.000}"/> 
         </Columns> 
         <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> 
        </asp:GridView> 

Antwort

2

können Sie Gridview mit leeren Datensatz oder Datentabelle binden. Zeigen Sie dann nur die Gridview-Spalte an.

1

die Eigenschaft der Rasteransicht ShowHeaderWhenEmpty Set = "true". Und dann binden Sie den leeren Datensatz oder die Datentabelle an Gridview.

GridView1.DataSource = dt; GridView1.DataBind();

Verwandte Themen