Ugh...I added a radiobuttonlist to the page and now when I select another radio button from the radiobuttonlist then export to excel I am getting a gridview that says no records. Here's the client side page:
<asp:RadioButtonList ID="Pending" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="Populategrid" Height="16px"
RepeatDirection="Horizontal" Width="755px">
<asp:ListItem Value="250">Pending Over 250</asp:ListItem>
<asp:ListItem Value="300">Pending Over 300</asp:ListItem>
<asp:ListItem Value="350">Pending Over 350</asp:ListItem>
<asp:ListItem Value="400">Pending Over 400</asp:ListItem>
</asp:RadioButtonList>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" EnableModelValidation="True" Width="789px"
CaptionAlign="Top" Height="126px" BackColor="White" BorderColor="#DCBE68"
BorderStyle="Solid" BorderWidth="1px" CellPadding="4"
HorizontalAlign="Center" CellSpacing="2" Font-Names="Arial"
AllowSorting="True" EmptyDataText="No Records" DataKeyNames="FO,CLMSSN">
<Columns>
<asp:BoundField DataField="DOC" HeaderText="DDS" SortExpression="DOC" />
<asp:BoundField DataField="RegionAcronym" HeaderText="Region" SortExpression="RegionAcronym"
/>
<asp:BoundField DataField="FO" HeaderText="FO" SortExpression="FO" />
<asp:BoundField DataField="CLMS" HeaderText="CLMS"
SortExpression="CLMS" />
<asp:BoundField DataField="Age" HeaderText="Age" ReadOnly="True"
SortExpression="Age" />
<asp:BoundField DataField="FileDate" HeaderText="File Date" ReadOnly="True"
SortExpression="DDSCode" DataFormatString="{0:d}" />
<asp:BoundField DataField="DDSReceipt" HeaderText="DDS Receipt" ReadOnly="True"
SortExpression="DDSReceipt" DataFormatString="{0:d}" />
<asp:BoundField DataField="DDSAge" HeaderText="DDS Age" ReadOnly="True"
SortExpression="DDSAge" />
<asp:BoundField DataField="Title" HeaderText="Title" ReadOnly="True"
SortExpression="Title" /> </Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC"
VerticalAlign="Top" Font-Size="Medium" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<RowStyle BackColor="White" BorderStyle="Double" ForeColor="#330099"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
</asp:GridView>
Here's the export to excel:
Protected Sub BtnExportExcel_Click1(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Dim sw As New IO.StringWriter() Dim hw As New HtmlTextWriter(sw)
GridView1.AllowPaging = False GridView1.DataBind()
GridView1.Caption = "DPB DDS Pending Claims Listings"
GridView1.HeaderRow.Attributes.Add("style", "font-size:10px")
For i As Integer = 0 To GridView1.HeaderRow.Cells.Count - 1
GridView1.HeaderRow.Cells(i).Style.Add("background-color", "#B43636")
'GridView1.HeaderRow.Cells(i).Style.Add("ss:WrapText", "1")
'GridView1.HeaderRow.Attributes.Add("ss:StyleID", "customHeader")
Next For i As Integer = 0 To GridView1.Rows.Count - 1
Dim row As GridViewRow = GridView1.Rows(i)
'Change Color back to white
row.BackColor = System.Drawing.Color.White
'Apply text style to each Row
row.Attributes.Add("class", "textmode") Next
'Remove Controls Me.RemoveControls(GridView1)
Response.Write(AddExcelStyling()) GridView1.RenderControl(hw)
'style to format numbers to string
Dim style As String = "<style> .textmode { mso-number-format:\@; } </style>"
Response.Write(style) Response.Output.Write(sw.ToString())
Response.Flush() Response.[End]() End Sub
What do I add so that when I select another button from the Radiobuttonlist it will then export that to excel?