14 Answers, 1 is accepted
I have two combos that are stringed together. On client itemsRequested of first combo, i clear second combo text, clear items, RequestItems for second combo, and set text to first item of second combo. I start getting that message if i change the text of first combo. Does anybody know how to get rid of or suppress that message? code is below:
<
telerik:RadComboBox
id="RadComboBox1"
Runat="server"
Height="140px"
width="150px"
EnableLoadOnDemand="True"
AllowCustomText="True"
ItemRequestTimeout="500"
MarkFirstMatch="True"
OnClientFocus="OnClientFocus"
OnClientItemsRequesting="StopRequesting"
OnItemsRequested="RadComboBox1_ItemsRequested"
OnClientItemsRequested='ComboItemsRequestedWO'
Text='<%# Bind("WONum") %>'
>
</telerik:RadComboBox> </td>
<td style="width: 48px; height: 87px;">Charge Code:</td>
<td style="height: 87px"><telerik:RadComboBox
id="RadComboBoxCC"
Runat="server"
Height="140px"
width="150px"
ShowMoreResultsBox="True"
AllowCustomText="True"
ItemRequestTimeout="500"
OnItemsRequested="RadComboBoxCC_ItemsRequested"
Text='<%# Bind("ChargeCode") %>'
>
</telerik:RadComboBox></td>
<
script language="javascript" type="text/javascript">
function ComboItemsRequestedWO()
{
Telerik.Web.UI.RadComboBox.ComboBoxes[1].set_text(
"");
Telerik.Web.UI.RadComboBox.ComboBoxes[2].set_text(
"");
alert(
"set text to nothing");
var items = Telerik.Web.UI.RadComboBox.ComboBoxes[1].get_items();
items.clear();
alert(
"cleared cc items");
items = Telerik.Web.UI.RadComboBox.ComboBoxes[2].get_items();
items.clear();
alert(
"cleared loc items");
Telerik.Web.UI.RadComboBox.ComboBoxes[1].requestItems(
"ChargeCode", true);
var strSelectText = "";
var itemsCC = Telerik.Web.UI.RadComboBox.ComboBoxes[1].get_items();
alert(
"got items");
strSelectText = itemsCC.getItem(0).get_text();
alert(strSelectText);
Telerik.Web.UI.RadComboBox.ComboBoxes[1].set_text(strSelectText);
alert(
"set cc");
alert(
"finished");
}
</
script>
<script language="javascript" type="text/javascript">
function StopRequesting(sender, eventArgs)
{
if (sender.get_text().length < 9)
{
eventArgs.set_cancel(
true);
}
}
</
script>
Protected Sub RadComboBox1_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim db As Database = DatabaseFactory.CreateDatabase("JSAS_DevConnectionString")
Dim sqlCmd As String = "spJSAS_GetWONumOnDemand"
Dim dbCmd As SqlCommand = db.GetStoredProcCommand(sqlCmd)
db.AddInParameter(dbCmd,
"@WONum", DbType.String, e.Text)
Dim reader As IDataReader = db.ExecuteReader(dbCmd)
Dim combo As Telerik.Web.UI.RadComboBox = o
While reader.Read()
Dim item As Telerik.Web.UI.RadComboBoxItem = New Telerik.Web.UI.RadComboBoxItem(reader("WONum").ToString)
combo.Items.Add(item)
End While
Session(
"WoNum") = e.Text
End Sub
Protected Sub RadComboBoxCC_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim db As Database = DatabaseFactory.CreateDatabase("JSAS_DevConnectionString")
Dim sqlCmd As String = "spJSAS_GetChargeCode"
Dim dbCmd As SqlCommand = db.GetStoredProcCommand(sqlCmd)
db.AddInParameter(dbCmd,
"@WONum", DbType.String, Session("WONum").ToString())
Dim reader As IDataReader = db.ExecuteReader(dbCmd)
Dim combo As Telerik.Web.UI.RadComboBox = o
combo.Items.Clear()
While reader.Read()
Dim item As Telerik.Web.UI.RadComboBoxItem = New Telerik.Web.UI.RadComboBoxItem(reader("ChargeCode").ToString)
combo.Items.Add(item)
End While
End Sub
Thanks for bringing this to our attention.
We have logged this in our bug tracking system and we will fix it for the next version of the control.
Meanwhile I suggest you try the following code:
sender.get_items().forEach(function(item){ if(item) item.get_comboBox().get_items().remove(item)});
instead of items.clear();
Let us known how this goes.
Regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you!
vithiya
Please find attached our latest official version.
This should fix the problem.
Regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
On another tab, I have a load on demand combobox that can have several thousand items. Again I only load 10 at a time. The first 10 can take 10 - 15 seconds to load. After that it works fairly well. It is the inital load that my clients are seeing the JSON error. The combobox still loads but I would prefer they don't see the error and that the inital load time is quicker.
I am using the 2008.2.826.35 dll.
I suggest you try our latest official build - 2008.2.1001. If the problem still persists, please send us a sample running project illustrating the issue.
As for the performance please read - Combobox callback is slow.
Regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
For item lists with no invisible items, I don't get the error when populating using the itemsrequested handler. I also get no error when loading the combo via a page load handler regardless of the combo having invisible items.
I tried the suggestion to avoid the Items.clear method, but that had no affect on the outcome.
This is going to be a major problem for me when I have to inactivate items.
Here is my code:
radComboBox.Items.Clear();
foreach (TableItem tblItem in itemList)
{
RadComboBoxItem cboItem = new RadComboBoxItem(tblItem.ItemName, tblItem.ItemId.ToString());
cboItem.Visible = tblItem.Active;
radComboBox.Items.Add(cboItem);
}
How to use sender.get_items().forEach(function(item){ if(item) item.get_comboBox().get_items().remove(item)});
this code
I have simple RadComboBox as below and i want to clear all the items in item requested before binding new data
<telerik:RadComboBox ID="AutoRadComboBox" runat="server" Width="254px" Height="150px"
EmptyMessage="Click to select value" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
AutoPostBack="true" EnableVirtualScrolling="true" OnItemsRequested="AutoRadComboBox_ItemsRequested"
OnSelectedIndexChanged="AutoRadComboBox_SelectedIndexChanged"
onitemdatabound="AutoRadComboBox_ItemDataBound"
AppendDataBoundItems ="false"
Skin="Sunset">
</telerik:RadComboBox>
C# code
AutoRadComboBox.DataSource = dvBrowse.Table;
AutoRadComboBox.DataBind();
I have this in item requested, but the previous values are not getting removed after binding new datatable.
Regards
Rupali
Does any one hve solution of this error? I am getting this error
Regards,
Kunal
RadPanelBar rpb; |
rpb = new RadPanelBar(); |
rpb.ID = "rpb"; |
rpb.Width = 1140; |
rpb.Height = 500; |
rpb.ExpandMode = PanelBarExpandMode.MultipleExpandedItems; |
rpb.Items.Add(new RadPanelItem("Group one")); |
rpb.Items.Add(new RadPanelItem("Group two")); |
rpb.Items[0].Items.Add(new RadPanelItem()); |
rpb.Items[1].Items.Add(new RadPanelItem()); |
rpb.Items[1].Items.Add(new RadPanelItem()); |
rpb.Items[0].Expanded = false; |
rpb.Items[0].Items[0].Value = "val1"; |
rpb.Items[0].Items[0].Controls.Add(controlI); |
rpb.Items[1].Expanded = true; |
rpb.Items[1].Items[0].Value = "val2"; |
rpb.Items[1].Items[0].Controls.Add(controlII); |
rpb.Items[1].Items[1].Value = "val3"; |
rpb.Items[1].Items[1].Controls.Add(controlIII); |
controlIII = new Control(); |
UpdatePanel updatePanelIII = new UpdatePanel(); |
updatePanelIII.ID = "updatePanelIII"; |
updatePanelIII.UpdateMode = UpdatePanelUpdateMode.Conditional; |
Panel panelIII = new Panel(); |
panelIII.ID = "panelIII"; |
panelIII.Style.Add("margin-left", "10px"); |
panelIII.Controls.Clear(); |
panelIII.Controls.Add(new LiteralControl("<table><tr><td>")); |
panelIII.Controls.Add(lblPocetKusuPridaniPolozkyPresKod);//some Label |
panelIII.Controls.Add(txtPocetKusuPridaniPolozkyPresKod);//some textbox |
panelIII.Controls.Add(new LiteralControl("</td><td>")); |
panelIII.Controls.Add(lblPridejDleCisla);//some Label |
panelIII.Controls.Add(txtPridejDleCisla);//some textbox |
panelIII.Controls.Add(lblPridejDleCislaHlaska);//some Label |
panelIII.Controls.Add(new LiteralControl("</td><td>")); |
panelIII.Controls.Add(imgbtnPridatDleCislaDokladu);//some imagebutton |
panelIII.Controls.Add(new LiteralControl("</td><td>")); |
panelIII.Controls.Add(btnSmazatVybraneKarty);//some button |
panelIII.Controls.Add(new LiteralControl("</td></tr>")); |
panelIII.Controls.Add(new LiteralControl("<tr><td>")); |
panelIII.Controls.Add(btnVyberKartyProDoklad);//some button |
panelIII.Controls.Add(new LiteralControl("</td></tr></table>")); |
updatePanelIII.ContentTemplateContainer.Controls.Add(panelIII); |
updatePanelIII.Update(); |
controlIII.Controls.Add(updatePanelIII); |
Best wishes,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I am seeing this problem too. I am doing both loading of combos on demand and with item templates, as well as populating literal controls within radpanels (within pageviews within master/content pages).
Unfortunately our project is too complex to attach a repro. I can provide the code that asserts though, if that will help:
This starts at line 5525, Telerik.Web.UI.dll 2009.3.1314.35
a.RadPanelBar._createChildControls=function(e,f){var d=e.get_itemData(); |
if(!d){return; |
}var c=e.get_childListElement(); |
if(!c){return; |
}var j=$telerik.getChildrenByTagName(c,"li"); |
Sys.Debug.assert(d.length==j.length,"Length of elements and json must be the same!"); |
for(var g=0; |
g<d.length; |
g++){var h=new a.RadPanelItem(); |
f.add(h); |
h._initialize(d[g],j[g]); |
}}; |
(edited to fix the typo where I mispelled typo, lol)