在asp.net中,GridView的标题不稳定

时间:2018-11-23 05:29:04

标签: c# asp.net gridview grid

在我的页面加载中,显示了gridview标头,但几秒钟后它自动消失了。

<asp:GridView ID="GridView1" HeaderStyle-CssClass="bg-blue" ShowHeaderWhenEmpty="true" runat="server" AutoGenerateColumns="true" ViewStateMode="Enabled" CssClass="table table-bordered">
                        <Columns>
                            <asp:BoundField DataField="F4" HeaderText="Employee Code"></asp:BoundField>
                            <asp:BoundField DataField="F6" HeaderText="Employee Name"></asp:BoundField>
                        </Columns>

在页面加载中:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Label2.Visible = false;
                  GridView1.DataSource = new System.Collections.ArrayList();
            GridView1.DataBind();

            }

        }

0 个答案:

没有答案