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

all the checked values on selected index change.

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alyssa
Top achievements
Rank 1
Alyssa asked on 20 Dec 2013, 12:23 PM
Hi,
i have a radcombobox with checkboxs=true. On the onselectedindexchange event i want all the checked values.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Dec 2013, 12:29 PM
Hi Alyssa,

Please try the following code snippet.

ASPX:
<telerik:GridTemplateColumn HeaderText="ShipCountry">
    <ItemTemplate>
        <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource2" AutoPostBack="true" CheckBoxes="true" DataTextField="ShipCountry" DataValueField="ShipCountry" EmptyMessage="...Select..." EnableCheckAllItemsCheckBox="true" OnSelectedIndexChanged="RadComboBox2_SelectedIndexChanged">
        </telerik:RadComboBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>
. . . . .
 <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

C#:
protected void RadComboBox2_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
  RadComboBox combo = (RadComboBox)sender;
  GridDataItem data = (GridDataItem)combo.NamingContainer;
  string id = data.GetDataKeyValue("OrderID").ToString();
      var sb = new StringBuilder();
  var collection=combo.CheckedItems;
      if ( collection.Count != 0 )
      {
          sb.Append( "<ul>" );
          foreach ( var item in collection )
          sb.Append("<li>" + item.Text + "</li>");
          sb.Append( "</ul>" );
          Label1.Text = sb.ToString();
      }
}

Thanks,
Princy
Tags
Grid
Asked by
Alyssa
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or