This is a migrated thread and some comments may be shown as answers.

Radcombobox no postback on checked items

1 Answer 61 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 10 Jul 2013, 02:48 PM
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
               Next
           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
       myRadGrid.Rebind()
   End Sub
 
   Protected Sub ddlRadTeam_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ddlRadTeam.SelectedIndexChanged
       fillGrid = True
       myRadGrid.Rebind()
   End Sub






























































1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 11 Jul 2013, 03:08 PM
Hello,

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?

Regards,
Boyan Dimitrov
Telerik
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.
Tags
ComboBox
Asked by
Kevin
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or