---
title: "GridView的DataBind相关的事件会触发两次的情况"
author: "didasoft"
date: "2007-11-08T10:16:00Z"
tags: ["Google", "HTML"]
slug: "gridview-databind"
draft: false
lastmod: "2007-11-08T10:16:00Z"
id: 274503
url: "https://didasoft.iteye.com/blog/274503"
---

今天碰到一个很奇怪的问题，在GridView的EnableViewState设置为false的情况下，GridView的DataBind会触发两次。真是郁闷。后来在Google上搜了一下，原来这是GridView的机制。当EnableViewState为false的情况下，GridView需要在处理事件之前绑定一次数据，以便恢复控件的属性。而处理事件结束之后，还会做正常的页面数据绑定。以下这个页面对此有详细的讨论：

http://www.thescripts.com/forum/thread484156.html