Hey all,
I'm looking at binding a DataTable to the drop down. There are 2 columns (Code and Name) in the DataTable and 1,400+ rows.
Ideally, I want to be able to search as you type. But it seems to take forever to do it. I am binding in code to do this when the page is loaded using the following simple 3 lines:
WebDropDown1.DataSource = ds.Tables(0)WebDropDown1.TextField = "Code"WebDropDown1.DataKeyFields = "Code"
Is there a fast way to do this when running (or any suggestions) ?
Can you display Code and Name in the dropdown portion? I've looked at the WebCombo which pretty much displays what I want but is slow also - and I can't see how to implment search as you type.
Any pointers would be good thanks.
Hi,
You should not rebind on every Page_Load. You should check whether the request is postback, and only if it is initial page load, databind and set a DataSource.
Client side filtering and LoadOnDemand are not compatible. Client-side filtering only filters on the client, while load on demand does an AJAX request to fetch more data from the server.
Moreover, client filtering will load and create all items at once on the client.
I would suggest using Server filtering with LoadOnDemand=True, and a reasonable PageSize setting. If you only set EnableAutoFiltering="Server", you do not need any code in the code behind. You can also use the paging functionality. Both paging and load on demand work fine with server-side filtering.
What is your current value for PageSize ? If it is zero, all items will be loaded anyway.
I hope this helps. Thanks for the feedback,
Angel
Angel,
I've decided to use the WebCombo as it is giving good performance and a reasonable TypeAhead for our data. Overall it seems easier to use. I will experiment a little more with the WebDropDown when I get some time.
Cheers for the help
Andez
Indeed I did overlook it.
Template overview can be found in the Developers Reference in the online documentation:
https://www.infragistics.com/help/aspnet/webdropdown-templating
Hi Guys,
I thought I'd play with the grid a bit more and went back to the drawing board. Think I may have hit a same problem as yourself Mark.
I'm setting my page size to 200. When the page loads, it loads very fast. Then when I expand the drop down, I get the javascript error. The drop down just crashes. I've played with the properties and I have tried various combinations of the following:
EnableAnimations = FalseEnableClosingDropDownOnBlur = TrueEnableClosingDropDownOnSelect = True' Performance Related SettingsEnableAutoFiltering = ServerEnableLoadOnDemand = TruePageSize = 300
Any ideas? I've attached the offending pages in a zip file.
Hi Andez,
I looked at your sample - the WebDataDropDownSimpleFilter.aspx. There you have EnableLoadOnDemand=true, and the javascript error is thrown when you scroll down (i.e. when load on demand is invoked). I don't get any javascript error as soon as i open the dropdown.
The issue here is that the dropdown doesn't have any DataSource assigned, and it's only bound on the first page load - but LoadOnDemand will call DataBind() on every load on demand operation (which is because the datasource changes with the newly added items). Since on this load on demand operation, there is no data source assigned, it doesn't bind anything.
in the VB.NET code behind, if you comment this line everything will work fine:
' If Not Me.IsPostBack Then
(i.e now it will data bind on every postback, so that load on demand can correctly mark how many dropdown item objects to create and data bind, from the real data source underneath).
Hope this helps,
Is it mandatory to have the data binding code always in the "page_load" event with no "Page.IsPostBack" check?
I have more than 8 WebDropDown controls on a page. When the user scrolls down to the end of the list in one of the WebDropDown control, how will be the remaining webDropDown controls behave? Does all the WebDropDown controls make a database roundtrip or only the user selected WebDropDown control will do?
My concern is - I have other events on the page that causes a postback, so everytime the WebDropDown databinding code in the "page_load" will fire. How can I avoid this?
Thanks
hi,
Not at all. It's only necessary if you have EnableViewState=false and bind to datasource objects, or if you have EnableViewState=false, and refer to the DataItems in code behind, that is, when they are part of your template.
I am not clear at your response. I have EnableViewState=true. Should I bind my WebDropDown everytime on the page_load event when the user scrolls to the end of the list?
<ig:WebDropDown ID="WebDropDown2" runat="server" EnableClosingDropDownOnSelect="False" EnableLoadOnDemand="True" EnableMultipleSelection="True" PageSize="20" LoadingItemsMessageText="Loading items..." Width="200px">
</ig:WebDropDown>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
PopulateWebDropDown2();
}
If I add the code (!Page.IsPostBack), the load on demand feature doesn’t work. But if comment that code, it works. Any suggestion!!
It depends how you databind - if you use a DataSource object, for example DataSet or DataTable, you need to store the reference to the datasource in the session (for example) and then set it , if it is a postback. So it is created only once, but it is still set on every postback, otherwise the data is lost when load on demand tries to databind again.
Thank you,
Hi i am having similar issues as paul, i get the same script message he was getting and im not sure what to do about it. the performance of the dropdown is awful and it hardly works. here is my code:
<ig:WebDropDown ID="WebDropDown1"
runat="server"
EnableMultipleSelection="True"
EnableAnimations="False"
EnableCustomValues="False"
EnableCustomValueSelection="False"
EnableEmbeddedJavaScript="True"
EnableAjaxViewState="True"
EnableAutoFiltering="Server"
EnableClosingDropDownOnSelect="True"
EnableAutoCompleteFirstMatch="True"
DropDownContainerMaxHeight="100px"
DropDownContainerWidth="500px"
EnableLoadOnDemand="True" PageSize="400"> </ig:WebDropDown>
code behind:
//gets the employees from the table and puts them into an infragistics dropdown. SqlConnection connection = null; connection = new SqlConnection(utilities.getConnectionString()); SqlCommand command = new SqlCommand("dbo.spGetEmployees", connection); command.CommandType = CommandType.StoredProcedure; SqlParameter returnValueParam = new SqlParameter("@RETURN_VALUE", SqlDbType.Int); returnValueParam.Direction = ParameterDirection.ReturnValue; command.Parameters.Add(returnValueParam); SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet dsEmployees = new DataSet(); adapter.SelectCommand = command; adapter.Fill(dsEmployees); WebDropDown1.DataSource = dsEmployees; WebDropDown1.TextField = "fullname"; WebDropDown1.ValueField = "fullname"; WebDropDown1.DataBind();
I need this dropdown to autocomplete and multiple selection. other then that i dont care what the settings are set to as long is it works more effectively.
Thanks!
Are you experiencing these performance issues on initial page load, or when a postback takes place ? Also, which build of the assembly are you using?
well after reading some of the posts i move my code behind for loading the ddl to the !isPostBack. i am using 10.2 and vs 2010 net 3.5