2014-04-01 105 views
1

當我添加,刪除,更新操作時,我需要始終在表單的表頭位置顯示此網格。任何機構請幫助我。提前致謝。在瀏覽器窗口頂部顯示內容

 <asp:GridView ID="Grd_View" ShowFooter="True" runat="server" OnRowEditing="Grd_View_RowEditing" AutoGenerateColumns="False" 
    DataKeyNames="CustomerCode" CellPadding="4" OnRowCommand="Grd_View_RowCommand" GridLines="None" 
    AllowPaging="True" AllowSorting="True" CssClass="style2" ForeColor="#333333" Width="569px" OnRowDataBound="Grd_View_RowDataBound" OnRowDeleting="Grd_View_RowDeleting"> 
    <FooterStyle BackColor="#555555" ForeColor="White" Font-Bold="True" /> 
    <Columns> 
     <asp:BoundField DataField="CustomerCode" HeaderText="CustomerCode" InsertVisible="False" 
      ReadOnly="True" SortExpression="CustomerCode" /> 

     <asp:BoundField DataField="CustomerName" HeaderText="CustomerName" SortExpression="CustomerName" /> 

     <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" /> 
     <asp:BoundField DataField="TellNo" HeaderText="TellNo" SortExpression="TellNo" /> 
     <asp:BoundField DataField="FaxNo" HeaderText="FaxNo" SortExpression="FaxNo" /> 
     <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" /> 
     <asp:TemplateField> 
      <ItemTemplate> 
       <asp:LinkButton ID="btnEdit" runat="server" CommandArgument='<%#Eval("CustomerCode")%>' CommandName="Edit" Text="Edit"> 
       </asp:LinkButton> 
      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField> 
      <ItemTemplate> 
       <asp:LinkButton ID="btnDelete" runat="server" CommandArgument='<%#Eval("CustomerCode")%>' CommandName="Delete" Text="Delete"> 
       </asp:LinkButton> 
      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField> 
      <FooterTemplate> 
       <asp:LinkButton ID="btnNew" runat="server" CommandArgument='<%#Eval("CustomerCode")%>' CommandName="New" Text="New"> 
       </asp:LinkButton> 
      </FooterTemplate> 
     </asp:TemplateField> 

    </Columns> 

    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> 
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> 
    <PagerStyle BackColor="#777777" ForeColor="White" HorizontalAlign="Center" /> 
    <HeaderStyle BackColor="#555555" Font-Bold="True" ForeColor="White" /> 
    <EditRowStyle BackColor="#999999" /> 
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> 

</asp:GridView> 
+0

看看m Ÿ回答。希望它能幫助你解決你的問題。不要忘記註冊並將其標記爲答案,以便它可以幫助其他開發者。 – SpiderCode

回答

0

把你的網格視圖div標籤內有頂部離開位置風格如下:

<div style="top: 0%; left: 45%; position: absolute; z-index: 999"> 
    <asp:GridView ID="Grd_View" ShowFooter="True" runat="server" OnRowEditing="Grd_View_RowEditing" AutoGenerateColumns="False" 
     DataKeyNames="CustomerCode" CellPadding="4" OnRowCommand="Grd_View_RowCommand" GridLines="None" 
     AllowPaging="True" AllowSorting="True" CssClass="style2" ForeColor="#333333" Width="569px" OnRowDataBound="Grd_View_RowDataBound" OnRowDeleting="Grd_View_RowDeleting"> 
     ... 
     ... 
     ... 
    </asp:GridView> 
</div> 
+0

我明白了.....謝謝先生 – chrish549

0

你要包裝你的網格視圖固定Div的內部的固定頭 對於前:

<div style ="height:200px; width:617px; overflow:auto;"> 
<asp:GridView ID="GridView1" runat="server" 
    AutoGenerateColumns = "false" Font-Names = "Arial" ShowHeader = "false" 
    Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" > 
    <Columns> 
    <asp:BoundField ItemStyle-Width = "150px" DataField = "CustomerID" /> 
    <asp:BoundField ItemStyle-Width = "150px" DataField = "City" /> 
    <asp:BoundField ItemStyle-Width = "150px" DataField = "Country" /> 
    <asp:BoundField ItemStyle-Width = "150px" DataField = "PostalCode" /> 
    </Columns> 
</asp:GridView> 
</div> 
+0

我的意思是當我打開窗體網格視圖應該出現在頂部和中間位置先生... – chrish549

相關問題