I have a radcombobox with checkboxes. It has a javascript that has to enable another textbox depending on the value of selected item.
The javascript is called when the checkbox is selected but it does not find selected items first time.
when we click second time it finds only the first one. And so on.
I have a code snippet to reproduce this issue. This used to work before I installed updates.
2015.1.225.40 installed.
I am using C# 2012
.net vesrion 4.5
In this code snippet, I am updating the value of label. The Label shows the values of selected items '-' seperated.
So first time if I select 44 (value 4) .... The Label shows nothing
then if I select 11(value 1) .... The Label shows -4
then if I select 77(value 7) .... The Label shows -1- 4
and so on.
I hope I have explained my scenario good enough. Please let me know if you need any more clarification.
------------- Javascript -----------
function OnNCAAChange(sender, args) {
var NCAA;
var Label1;
NCAA = $telerik.$("[id$='UINCAA']");
Label1 = $telerik.$("[id$='Label1']");
Label1[0].textContent = "";
for (var i = 0; i < sender.get_items().get_count() ; i++) {
var item = sender.get_items().getItem(i);
var checkbox = item.get_checkBoxElement();
if (checkbox.checked) {
Label1[0].textContent = Label1[0].textContent + ' - ' + item.get_value();
}
}
}
--------- Controls -----------------
<telerik:RadComboBox runat="server" ID="UINCAA" Width="60%" CheckBoxes="true" EnableCheckAllItemsCheckBox="false"
OnClientItemChecking="OnNCAAChange" Style="z-index: 8100" MaxHeight="240" ItemsPerRequest="10">
</telerik:RadComboBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
--------Codebehind -------------
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//List<RadComboBoxItem> rcblist;
//rcblist = GlobalCodes.GetRCBListBySTSVer(GlobalCodes.Database.STS_Congenital, "3.22", "NCAA", false);
UINCAA.Items.Clear();
string t = "1";
for (int i = 1; i < 10; i++ )
{
//RadComboBoxItem hc;
RadComboBoxItem rc = new RadComboBoxItem();
rc.Text = t + i.ToString();
rc.Value = i.ToString();
UINCAA.Items.Add(rc);
}
}
}
The javascript is called when the checkbox is selected but it does not find selected items first time.
when we click second time it finds only the first one. And so on.
I have a code snippet to reproduce this issue. This used to work before I installed updates.
2015.1.225.40 installed.
I am using C# 2012
.net vesrion 4.5
In this code snippet, I am updating the value of label. The Label shows the values of selected items '-' seperated.
So first time if I select 44 (value 4) .... The Label shows nothing
then if I select 11(value 1) .... The Label shows -4
then if I select 77(value 7) .... The Label shows -1- 4
and so on.
I hope I have explained my scenario good enough. Please let me know if you need any more clarification.
------------- Javascript -----------
function OnNCAAChange(sender, args) {
var NCAA;
var Label1;
NCAA = $telerik.$("[id$='UINCAA']");
Label1 = $telerik.$("[id$='Label1']");
Label1[0].textContent = "";
for (var i = 0; i < sender.get_items().get_count() ; i++) {
var item = sender.get_items().getItem(i);
var checkbox = item.get_checkBoxElement();
if (checkbox.checked) {
Label1[0].textContent = Label1[0].textContent + ' - ' + item.get_value();
}
}
}
--------- Controls -----------------
<telerik:RadComboBox runat="server" ID="UINCAA" Width="60%" CheckBoxes="true" EnableCheckAllItemsCheckBox="false"
OnClientItemChecking="OnNCAAChange" Style="z-index: 8100" MaxHeight="240" ItemsPerRequest="10">
</telerik:RadComboBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
--------Codebehind -------------
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//List<RadComboBoxItem> rcblist;
//rcblist = GlobalCodes.GetRCBListBySTSVer(GlobalCodes.Database.STS_Congenital, "3.22", "NCAA", false);
UINCAA.Items.Clear();
string t = "1";
for (int i = 1; i < 10; i++ )
{
//RadComboBoxItem hc;
RadComboBoxItem rc = new RadComboBoxItem();
rc.Text = t + i.ToString();
rc.Value = i.ToString();
UINCAA.Items.Add(rc);
}
}
}