示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <Contact> contacts = Contact.getAll();
                gvMain.DataSource = contacts;
                gvMain.DataBind();

                gvMain.UseAccessibleHeader = true;
                if (contacts.Count > 0)
                {
                    gvMain.HeaderRow.TableSection = TableRowSection.TableHeader;
                    gvMain.FooterRow.TableSection = TableRowSection.TableFooter;
                }
            }
        }