сначала нужно добавить кнопки радио следующим образом:
<tr>
<td>
</td>
<td>
<asp:RadioButtonList ID="rblFormat" runat="server" RepeatDirection="Horizontal" CssClass="Profiletitletxt">
<asp:ListItem Text="PDF" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="MS Word" Value="2"></asp:ListItem>
<asp:ListItem Text="MS Excel" Value="3"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
</td>
</tr>
в коде в отчете связывания добавить:
If rblFormat.SelectedValue = 1 Then
cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "ExportedReport")
ElseIf rblFormat.SelectedValue = 2 Then
cryRpt.ExportToHttpResponse(ExportFormatType.WordForWindows, Response, True, "ExportedReport")
ElseIf rblFormat.SelectedValue = 3 Then
ExportDataSetToExcel(DT, "ExportedReport")
End If
Для Excel добавить:
Public Shared Sub ExportDataSetToExcel(ByVal ds As DataTable, ByVal filename As String)
Dim response As HttpResponse = HttpContext.Current.Response
response.Clear()
response.Buffer = True
response.Charset = ""
response.ContentType = "application/vnd.ms-excel"
Using sw As New StringWriter()
Using htw As New HtmlTextWriter(sw)
Dim dg As New DataGrid()
dg.DataSource = ds
dg.DataBind()
dg.RenderControl(htw)
response.Charset = "UTF-8"
response.ContentEncoding = System.Text.Encoding.UTF8
response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble())
response.Output.Write(sw.ToString())
response.[End]()
End Using
End Using
End Sub
Вы были в состоянии решить эту проблему с предложением, приведенным ниже? –