我有开发快递 ASPxGridView。gridview 的列和数据将根据下拉值动态变化。
If type = "procedure" Then
SqlDataSource2.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
Else
SqlDataSource2.SelectCommandType = SqlDataSourceCommandType.Text
End If
SqlDataSource2.SelectCommand = rptquery
Try
SqlDataSource2.DataBind()
dataview1 = SqlDataSource2.Select(System.Web.UI.DataSourceSelectArguments.Empty)
gv.DataSourceID = "SqlDataSource2"
For Each dc In dataview1.Table.Columns
Dim DynamicColumn = New DevExpress.Web.ASPxGridView.GridViewDataTextColumn()
DynamicColumn.FieldName = dc.ColumnName
DynamicColumn.Caption = dc.ColumnName
gv.Columns.Insert(i, DynamicColumn)
i = i + 1
Next
gv.DataBind()
Catch ex As Exception
End Try
然后我有导出按钮到excel。我的问题是它只会将gridview的列名导出到excel sheey中。数据为空。但在 gridview 中显示数据。请在这个问题上帮助我。