问题描述
绑定datagrid的代码col=NewBoundColumncol.DataField="order_date"col.HeaderText="订货日期"col.SortExpression="order_date"col.ItemStyle.HorizontalAlign=HorizontalAlign.RightDataGrid1.Columns.Add(col)排序代码PrivateSubMySort()DimthisSortField,thisModeAsStringDimconnAsNewSqlClient.SqlConnection(sysConfig.ConStr)DimmyDataAdapterAsNewSqlClient.SqlDataAdapterthisSortField=Me.DataGrid1.Attributes("SortExpression")thisMode=Me.DataGrid1.Attributes("SortDirection")DimdvAsNewDataViewDimdsAsNewDataSetstrsql="select*from表"myDataAdapter=NewSqlClient.SqlDataAdapter(strsql,conn)myDataAdapter.Fill(ds)dv=ds.Tables(0).DefaultViewdv.Sort=thisSortField+""+thisModeMe.DataGrid1.DataSource=dvMe.DataGrid1.DataBind()EndSubDataGrid1_SortCommand事件的代码DimSortFieldAsStringSortField=e.SortExpression.ToStringMe.DataGrid1.Attributes("SortExpression")=SortFieldIfMe.DataGrid1.Attributes("SortDirection")="ASC"ThenMe.DataGrid1.Attributes("SortDirection")="DESC"ElseMe.DataGrid1.Attributes("SortDirection")="ASC"EndIfMySort()我点击完列头根本就不触发DataGrid1_SortCommand事件,怎么回事呀???????????在线等