Hi There
I have a webdropdown that is bound to a sql dataset to populate its items. When the dropdown is opened it will not select the first item in the list. If any other item is selected first then the initial item is reselected it will select OK. Code as follows:
<ig:WebDropDown ID="WebDropDownPrincipalID" runat="server" Width="150px" DropDownAnimationType="Linear" DropDownContainerHeight="0px" DropDownContainerMaxHeight="0px" DropDownContainerWidth="0px" StyleSetName="Trendy" onitemsrequested="WebDropDownPrincipalID_ItemsRequested"> <clientevents focus="wddOpening" /> </ig:WebDropDown>
function wddOpening(sender, e) { sender.loadItems(); }
I have investigated this at length and cannot see what is going on.
Any suggestions??
Hi,
Thanks very much for your input. What code do you have in the ItemsRequested handler on the server-side? I am using this code in my handler, and i can select the first item, when items are loaded:
protected void WebDropDown1_ItemsRequested(object sender, Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs e)
{
this.SqlDataSource1.SelectCommand = string.Format("SELECT * FROM Products WHERE ProductName LIKE '{0}%'", e.Value.ToString().ToLower());
this.WebDropDown1.DataSource = SqlDataSource1;
this.WebDropDown1.DataBind();
}
The ASPX code and javascript client-side event handler I am using is the same as in your example above.
P.S: I am selecting the item with the mouse, not using the API (server or client-side) - if this could make a difference.
Thanks,
Angel
In fact if you have EnableAutoCompleteFirstMatch="true" (it is true by default), on the postback to load the initial items (assuming the dropdown is empty initially), it will automatically select the first item on the server, because it will think it matches the input string. You can avoid this behavior by setting EnableAutoCompleteFirstMatch to "false".
On the other hand, if you feel this is a bug, I can submit an internal request for further evaluation.
Thanks again for the feedback,