gridview的OnRowDataBound必须存在 <Columns>

简介:                       protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)     {         Response.



    <asp:sqldatasource id="CustomersSource"
      selectcommand="SELECT * from t_staff"
      connectionstring="<%$ ConnectionStrings:db_BSCConnectionString %>" 

      runat="server"/>


<asp:gridview id="CustomersGridView" 
  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");


    }

目录
相关文章
|
5月前
flutter- Row Column Expanded ListView
flutter- Row Column Expanded ListView
|
7月前
|
容器
QML之定位器(Column,Row,Flow,Grid)
QML之定位器(Column,Row,Flow,Grid)
697 2
207Echarts - 数据集(Series Layout By Column or Row)
207Echarts - 数据集(Series Layout By Column or Row)
51 0
55Echarts - 柱状图(Series Layout By Column or Row)
55Echarts - 柱状图(Series Layout By Column or Row)
47 0
|
API
DataTables中的column().visible()
在数据表中显示和隐藏列非常方便,尤其是在显示信息密度较大的表时。此方法允许即时更改单个列的可见性,或读取列的可见性状态。
173 0
ListView列宽自适应,设置ListView.Column[0].Width := -1;
使用TListView列表显示内容,如果列内容过长,就会显示成‘XXX…’形式,此时如果双击列标题,列宽将变为自适应。用代码设置如下: 1、设置ListView.Column[0].Width := -1;//列宽根据列内容自适应,此时保证列内容都可见。
3124 0