У меня есть 2 Datagrid и связаны с различными значениями. Мне нужно показать обе сетки данных в одном файле Excel на 2 листах.
Я пытался отобразить их, но отображается только одна сетка данных, и это тоже на одном листе.
Это vbсторона!
If lblError.Text = "" Then
dsExcelPayments = libFunctions.GetAwardsPaymentList(Session("ID"), Session("GMID"), ddlFilter.SelectedValue, "NonDelinquentDue", txtAfter.Text, txtBefore.Text, ddlProgram.SelectedValue, ddlCycle.SelectedValue, ddlStatus.SelectedValue, "", "", "Display")
dsExcelPayments1 = libFunctions.GetAwardsPaymentList(Session("ID"), Session("GMID"), ddlFilter.SelectedValue, "DelinquentDue", txtAfter.Text, txtBefore.Text, ddlProgram.SelectedValue, ddlCycle.SelectedValue, ddlStatus.SelectedValue, "", "", "Display")
If ImgExcelButtonClicked Then
dsExcelPayments = libFunctions.FixVendorIDsForExcel(dsExcelPayments)
dsExcelPayments1 = libFunctions.FixVendorIDsForExcel1(dsExcelPayments1)
End If
If dsExcelPayments.Tables(0).Rows.Count > 0 Then
dgPaymentsToExcel.Columns(11).HeaderText = "Grantee " & Application("lbl.uInstitution")
dgPaymentsToExcel.Columns(12).HeaderText = "Payee " & Application("lbl.uInstitution") & " ID"
dgPaymentsToExcel.Columns(27).HeaderText = dsExcelPayments.Tables(0).Rows(0)("GrantorAccountNumberLabel").ToString()
dgPaymentsToExcel.Columns(28).HeaderText = dsExcelPayments.Tables(0).Rows(0)("GrantorAccountSubCode1Label").ToString()
dgPaymentsToExcel.Columns(29).HeaderText = dsExcelPayments.Tables(0).Rows(0)("GrantorAccountSubCode2Label").ToString()
dgPaymentsToExcel.Columns(30).HeaderText = dsExcelPayments.Tables(0).Rows(0)("GrantorAccountSubCode3Label").ToString()
dgPaymentsToExcel.Columns(31).HeaderText = dsExcelPayments.Tables(0).Rows(0)("GrantorChapterRef").ToString()
dgPaymentsToExcel.DataSource = dsExcelPayments
dgPaymentsToExcel.DataBind()
dgPaymentsToExcel.Visible = True
dgPaymentsToExcel.Caption = "<b>Payment(s) Due</b>"
dgPaymentsToExcel.HeaderStyle.BackColor = System.Drawing.Color.LightGray
dgPaymentsToExcel.CssClass = "grid-Table"
Session("ReportToExcel") = dgPaymentsToExcel
Session("ExcelFileName") = "DuePayments NonDelinquent"
Response.Redirect("~/Reports/ReportInExcel.aspx")
End If
If dsExcelPayments1.Tables(0).Rows.Count > 0 Then
dgPaymentsToExcel1.Columns(11).HeaderText = "Grantee " & Application("lbl.uInstitution")
dgPaymentsToExcel1.Columns(12).HeaderText = "Payee " & Application("lbl.uInstitution") & " ID"
dgPaymentsToExcel1.Columns(27).HeaderText = dsExcelPayments1.Tables(0).Rows(0)("GrantorAccountNumberLabel").ToString()
dgPaymentsToExcel1.Columns(28).HeaderText = dsExcelPayments1.Tables(0).Rows(0)("GrantorAccountSubCode1Label").ToString()
dgPaymentsToExcel1.Columns(29).HeaderText = dsExcelPayments1.Tables(0).Rows(0)("GrantorAccountSubCode2Label").ToString()
dgPaymentsToExcel1.Columns(30).HeaderText = dsExcelPayments1.Tables(0).Rows(0)("GrantorAccountSubCode3Label").ToString()
dgPaymentsToExcel1.Columns(31).HeaderText = dsExcelPayments1.Tables(0).Rows(0)("GrantorChapterRef").ToString()
dgPaymentsToExcel1.DataSource = dsExcelPayments1
dgPaymentsToExcel1.DataBind()
dgPaymentsToExcel1.Visible = True
dgPaymentsToExcel1.Caption = "<b>Payment(s) Due 2</b>"
dgPaymentsToExcel1.HeaderStyle.BackColor = System.Drawing.Color.LightGray
dgPaymentsToExcel1.CssClass = "grid-Table"
Session("ReportToExcel") = dgPaymentsToExcel1
Session("ExcelFileName") = "DuePayments Delinquent"
Response.Redirect("~/Reports/ReportInExcel.aspx")
End If
Else
lblError.Visible = True
divMessage.Visible = True
End If