Hi,
My Scenario is I have to export a RadGrid,
I have created a grid name grdExport in aspx file and binding datasource in aspx.vb file.
My problem is i have to assign datasource dynamically,
For example, I have 5 different datasources ie A,B,C,D,E
First i assign "A" datasource to grdExport i will prepare a workbook for that,
then i assign "B" datasource to grdExport i will prepare a workbook for that.
I will repeat the same above process for all the datasources,
my issue is data exporting but the datasource "A" is repeating for rest of the datasources,
I dont know what i have missed and where i missed,
Here is my code,
NOTE: GetProcessDataForExport() is inside the for loop, i have to assign different datasources based on parameter(ModuleId) i got.
Public Function GetProcessDataForExport(ByVal ModuleId As Integer) As xlsx.Workbook
Try
Dim Shift As New ShiftSettings(TabId)
Dim ds As DataSet
ds = SqlDataProvider.phdag_GetShiftTags(ModuleId, KPIModuleId)
grdExportData.MasterTableView.GetColumn("Description").Visible = CType(SgsSettings("show_Description"), Boolean)
grdExportData.MasterTableView.GetColumn("Tag").Visible = CType(SgsSettings("show_Tag"), Boolean)
grdExportData.MasterTableView.GetColumn("UOM").Visible = CType(SgsSettings("show_UOM"), Boolean)
grdExportData.MasterTableView.GetColumn("Limits").Visible = CType(SgsSettings("show_Range"), Boolean)
grdExportData.MasterTableView.GetColumn("Target").Visible = CType(SgsSettings("show_Plan"), Boolean)
grdExportData.MasterTableView.GetColumn("Current").Visible = CType(SgsSettings("show_CurrV"), Boolean)
grdExportData.MasterTableView.GetColumn("ShiftAvg").Visible = CType(SgsSettings("show_ShiftAvgV"), Boolean)
grdExportData.MasterTableView.GetColumn("Shift24HrAvg").Visible = CType(SgsSettings("show_Shift24HrV"), Boolean)
grdExportData.MasterTableView.GetColumn("ShiftMinVal").Visible = CType(SgsSettings("show_ShiftMinV"), Boolean)
grdExportData.MasterTableView.GetColumn("ShiftMaxVal").Visible = CType(SgsSettings("show_ShiftMaxV"), Boolean)
grdExportData.MasterTableView.GetColumn("TimeStamp").Visible = CType(SgsSettings("show_TimeStamp"), Boolean)
grdExportData.MasterTableView.GetColumn("CorrectiveAction").Visible = CType(SgsSettings("show_CorrAct"), Boolean)
'Add Row Values
Dim dt As DataTable = GetTagsByTagType(ds.Tables(1), TagType, DeviationType)
grdExportData.ExportSettings.IgnorePaging = True
grdExportData.ExportSettings.FileName = ModuleId
grdExportData.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx
grdExportData.DataSource = New String() {}
grdExportData.DataSource = dt
grdExportData.Rebind()
Return TryCast(grdExportData.MasterTableView.GenerateXlsxOutput(Of xlsx.Workbook)(), xlsx.Workbook)
Catch ex As Exception
End Try
End Function
Thanks.