I added a radiobuttonlist to the 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" Selected="True">Pending Over 350</asp:ListItem>
<asp:ListItem Value="400">Pending Over 400</asp:ListItem>
</asp:RadioButtonList>
I have sorting turned on in the gridview:
<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="DOC" SortExpression="DOC" />
<asp:BoundField DataField="RegionAcronym" HeaderText="Region" SortExpression="RegionAcronym" />
<asp:BoundField DataField="FO" HeaderText="FO" SortExpression="FO" />
<asp:BoundField DataField="CLMSSN" HeaderText="CLMSSN"
SortExpression="CLMSSN" />
<asp:BoundField DataField="Age" HeaderText="Age" ReadOnly="True"
SortExpression="Age" />
<asp:BoundField DataField="FileDate" HeaderText="FileDate" ReadOnly="True"
SortExpression="FileDate" DataFormatString="{0:d}" />
<asp:BoundField DataField="DDS" HeaderText="DDS" SortExpression="DDS" />
<asp:BoundField DataField="DDSCode" HeaderText="DDSCode"
SortExpression="DDSCode" />
<asp:BoundField DataField="DDSReceipt" HeaderText="DDSReceipt" ReadOnly="True"
SortExpression="DDSReceipt" DataFormatString="{0:d}" />
<asp:BoundField DataField="DDSAge" HeaderText="DDSAge" 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>
When I try to sort in the gridview then go and select something from the radiobuttonlist again I am getting the
following error:
DataSource does not support sorting.
I'm getting it on Gridview1.DataBind()
If Pending.SelectedValue = "400" Then
Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("PendingClaimsConnectionString").ConnectionString)
Dim cmd As New Data.SqlClient.SqlCommand
Dim cmdPending As New Data.SqlClient.SqlCommand
With cmdPending
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "GetDDS400" .Connection = conn
.Parameters.AddWithValue("@doc", Request.QueryString("doc"))
End With
Dim adapter As New Data.SqlClient.SqlDataAdapter(cmdPending)
Try conn.Open()
Dim ds As New Data.DataSet adapter.Fill(ds)
GridView1.DataSourceID = ""
If GridView1.EmptyDataText = "" Then
Response.Write("No Pending Records") End If
GridView1.DataSource = ds GridView1.DataBind()
Finally conn.Dispose() End Try
End If End Sub
Do I need to handle the sorting a different way since I'm using a datalist?