Radcombobox no postback on checked items

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 10 Jul 2013 Link to this post

    I have a radCombobox that has multiple items in the dropwdown list, when users check the items they want to see the dropwdownlist should post back and return the items they want to see but it is not doing anything and I dont know if I am getting the items properly or its just not posting back.

    Here is the HTML
    <telerik:RadComboBox ID="ddlRadTeam" runat="server" Width="160px" BackColor="White" ForeColor="Black" EmptyMessage="Pick Team" AutoPostBack="true" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"></telerik:RadComboBox>

    Here is my filldatasource
    Protected Sub myRadGrid_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles myRadGrid.NeedDataSource
           Dim SqlWhere As String = ""
           Dim items As String = ""
           If rblActive.SelectedValue = Nothing Then
               SqlWhere = " where r.bitActive = 1"
               rblActive.SelectedValue = 1
           ElseIf rblActive.SelectedValue = "All" Then
               SqlWhere = ""
           ElseIf rblActive.SelectedValue = "0" Then
               SqlWhere = " where r.bitActive = 0"
           ElseIf rblActive.SelectedValue = "1" Then
               SqlWhere = " where r.bitActive = 1"
               rblActive.SelectedValue = 1
           End If
           If fillGrid = True Then
               If ddlRadTeam.CheckedItems.Count > 0 Then
                   For Each item As RadComboBoxItem In ddlRadTeam.Items
                       If item.Selected Then
                           items += item.Value & ","
                       End If
               End If
               If ddlRadTeam.SelectedItem.Checked = True And rblActive.SelectedValue = "All" Then
                   SqlWhere = " where r.intTeamId IN (" & items & ")"
               ElseIf ddlRadTeam.Items.Count > 0 Then
                   SqlWhere += " and r.intTeamId IN (" & items & ")"
               End If
           End If
           sql = "sql select " & SqlWhere
           myRadGrid.DataSource = getData(sql)
           pnlGrid.Visible = True
       End Sub

    this is my attempt to get the grid to post back using the selected index change of the combobox and the itemchecked but neither work.
    Protected Sub ddlRadTeam_ItemChecked(sender As Object, e As RadComboBoxItemEventArgs) Handles ddlRadTeam.ItemChecked
           fillGrid = True
       End Sub
       Protected Sub ddlRadTeam_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ddlRadTeam.SelectedIndexChanged
           fillGrid = True
       End Sub

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    1728 posts

    Posted 11 Jul 2013 Link to this post


    In order to avoid any further confusions I have attached a sample project that implements very similar scenario - selecting or checking an item from the RadComboBox control will force the RadGrid control to rebind in order to fire the NeedDataSource each time. As you can notice while debugging when user selects/checks an item the NeedDataSource server-side event handler is fired as expected. Could you please explain what exactly is different in your project?

    Boyan Dimitrov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. Telerik UI for ASP.NET Core is out
Back to Top