gridview的OnRowDataBound必须存在 <Columns>
<asp:sqldatasource id="CustomersSource"
selectcommand="SELECT * from t_staff"
connectionstring="<%$ ConnectionStrings:db_BSCConnectionString %>"
runat="server"/>
datasourceid="CustomersSource"
autogeneratecolumns="False"
emptydatatext="No data available."
allowpaging="True" OnRowDataBound="GridView1_RowDataBound"
runat="server" DataKeyNames="chn">
<Columns>
<asp:BoundField DataField="chn" HeaderText="CustomerID"
InsertVisible="False" ReadOnly="True" SortExpression="chn" />
</Columns>
</asp:gridview>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Response.Write("123");
}