2014-04-01 69 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

相关问题