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).
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?
| [WebMethod(CacheDuration = 0)] |
| public RadComboBoxItemData[] LoadMedportalUsers(RadComboBoxContext context) { |
| IDictionary<string, object> contextDictionary = (IDictionary<string, object>)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?