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

Too many items for Javascript to handle in a Callback

1 Answer 55 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Veteran
sitefinitysteve asked on 23 Jun 2010, 01:51 PM
I'm using the following demo to load Combo items from a DB which I don't have linked to an Entity model (so old command query).

 
    [WebMethod(CacheDuration = 0)] 
    public RadComboBoxItemData[] LoadMedportalUsers(RadComboBoxContext context) { 
        IDictionary<stringobject> contextDictionary = (IDictionary<stringobject>)context; 
        string filterString = ((string)contextDictionary["FilterString"]).ToLower(); 
 
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["myDB"].ConnectionString); 
 
         
        SqlCommand selectCommand = new SqlCommand(@" SELECT UserID, UserName FROM Aspnet_Users
                                                     WHERE LOWER(UserName) LIKE '%" + filterString + "%'", connection); 
 
        SqlDataAdapter adapter = new SqlDataAdapter(selectCommand); 
        DataTable users = new DataTable(); 
        adapter.Fill(users); 
 
        List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(users.Rows.Count); 
 
        foreach (DataRow row in users.Rows) { 
            RadComboBoxItemData itemData = new RadComboBoxItemData(); 
            itemData.Text = row["UserName"].ToString(); 
            itemData.Value = row["UserID"].ToString(); 
            result.Add(itemData); 
        } 
        return result.ToArray(); 
    } 

We have about 3000 users in the AspNet_Users table...so this throws:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

Is there perhaps a way to tweak to allow the dynamic loading?

Any way around that?


1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 24 Jun 2010, 01:26 PM
Hello Steve,

You can increase the maxJsonLength property value in your web.config as described here.

Kind regards,
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
Tags
ComboBox
Asked by
sitefinitysteve
Top achievements
Rank 2
Veteran
Answers by
Simon
Telerik team
Share this question
or