ASPxGridView的自动排序(写在onCustomUnboundColumnData()事件中)
//此排序写于后台,可打印出序号
protected void ASPxGridView_progoods_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
{
if (e.Column.FieldName == "NO" && e.IsGetData)
e.Value = (e.ListSourceRowIndex + 1).ToString();
}
//此排序只girivew中,不能打印出来
<Columns>
<dx:GridViewDataTextColumn Caption="序号" VisibleIndex="0" Width="1%">
<EditFormSettings Visible="False" />
<CellStyle HorizontalAlign="Center"></CellStyle>
<DataItemTemplate>
<dx:ASPxLabel ID="L_rowid_1" runat="server" Text='<%# Container.ItemIndex + 1 %>'>
</dx:ASPxLabel>
</DataItemTemplate>
</dx:GridViewDataTextColumn>
</Columns>