I have about 50,000 records in a dataset
I obviously can't retreive them all in a webdropdown but can I setup Autocomplete/filtering so I can bring back about 50 results at a time when the user types ahead in the dropdown? I tried setting EnableLoadOnDemand to true but it doesn't work on Autocomplete (just filters the first 50 or so records in the dataset)
Is this possible at all or does it have to be done on the database level?
Hi,
There is a property called AutoFilterResultSize, you can set it to 50, and it will only return the top 50 records when you have server-side filtering.
Hope it helps,
Angel
Even set to 50 it is really slow.
Are there any code samples available on Autocomplete with a large recordset?
Hello ,
Currently we do not have online sample with so large recordset
I tried to reproduce the slow behavior with the below code snippet.
I am using the latest service release of 10.3 and I was not able to reproduce the issue.
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
</asp:ScriptManager>
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px">
</ig:WebDropDown>
protected void Page_Load(object sender, EventArgs e)
{
WebDropDown1.DataSource = MakeTable();
WebDropDown1.ValueField = "RowNum";
WebDropDown1.TextField = "DisplayValue";
WebDropDown1.EnableAutoCompleteFirstMatch = false;
WebDropDown1.EnableAutoFiltering = Infragistics.Web.UI.ListControls.AutoFiltering.Server;
WebDropDown1.AutoFilterQueryType = Infragistics.Web.UI.ListControls.AutoFilterQueryTypes.Contains;
WebDropDown1.EnableViewState = false;
WebDropDown1.AutoFilterResultSize = 50;
WebDropDown1.EnableLoadOnDemand = true;
WebDropDown1.DataBind();
}
private DataTable MakeTable()
DataTable table = new DataTable("MaterialType");
DataColumn column;
DataRow row;
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "RowNum";
column.ReadOnly = true;
table.Columns.Add(column);
column.DataType = System.Type.GetType("System.String");
column.ColumnName = "DisplayValue";
column.AutoIncrement = false;
column.Caption = "DisplayValue";
column.ReadOnly = false;
column.Unique = false;
DataColumn[] PrimaryKeyColumns = new DataColumn[1];
PrimaryKeyColumns[0] = table.Columns["RowNum"];
table.PrimaryKey = PrimaryKeyColumns;
for (int i = 0; i <= 50000; i++)
row = table.NewRow();
row["RowNum"] = i;
row["DisplayValue"] = "DisplayValue " + i;
table.Rows.Add(row);
return table;
Let me know if you need further assistance.
Certainly. You can handle the ItemsRequested server-side event, it will pass the text that was entered by the user (in the event args object that is passed to the event handler). Then based on this text, you can invoke your web service, and add new DropDownItem objects for the results returned.
I have a similar but slightly different issue. Is there a way to make this work like the ajax toolkit? I have a web service that returns the data. The ajax version of this calls the web service when the text changes, and passes in the text, so only requests results that match. That limits the size of the result set.
it looks like WebDropdown would instead want to get the entire set, and then filter the results (optionally) as they type. Any way to change this behavior?