I can't get my OnselectedIndexChanged to fire.
<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>
Here's the codebehind:
Protected Sub Populategrid(ByVal sender As Object, ByVal e As EventArgs) Handles Pending.SelectedIndexChanged
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 = "GetDDS300" .Connection = conn
If Pending.SelectedValue = "300" Then
.Parameters.AddWithValue("@doc", Request.QueryString("doc"))
End If End With
Dim adapter As New Data.SqlClient.SqlDataAdapter(cmdPending) Try
conn.Open() Dim ds As New Data.DataSet
adapter.Fill(ds) GridView1.DataBind() Finally
conn.Dispose() End Try End Sub
I did a breakpoint in the codebehind and I do have the right selected value and the correct doc.
Since I am staying on the same page do I need something in pageload?
I put this in pageload but it doesn't do anything:
If Page.IsPostBack = True Then GridView1.DataBind() End If
I do have this in pageload too could this be messing it up?
'used for a back button on the page. So when use sort several times you can click on the button to go back to the counts.
If Page.IsPostBack = False Then
ViewState.Add("NbrPostbacks", "1") Else
ViewState.Item("NbrPostbacks") += 1 End If
btnback.PostBackUrl = String.Format("javascript:history.go(-{0});", ViewState.Item("NbrPostbacks"))