I have a multi-column comboBox which allows custom text and has "EnableLoadOnDemand" set to true. I want to populate the columns (4 in total) with a list of search results, based on an active directory search method (which returns UserID, Name, Email, Line Manager)
At present, the method works great when the user enters a surname into the text property and clicks a "Search" button (the method is assigned to the OnClick event of the button, obviously.)
What I would like to happen is for the user to enter the first few letters of a surname and the multi-column combobox will load the results on demand.
The results do not come from a datasource, as explained above.
Would this behaviour be possible at all?
As a framework, I have similar code structure to the example found here
Thanks.
Markup:
<telerik:RadComboBox ID="UserIDComboBox" runat="server" AllowCustomText="True" DropDownWidth="400px" MarkFirstMatch="True" EnableLoadOnDemand="true" OnItemsRequested="UserID_ItemsRequested" OnItemDataBound="UserID_ItemsDataBound" ToolTip="Type first 3 letters of Surname and click Search." Width="200px"> <HeaderTemplate> <ul> <li class="col1">User_ID</li> <li class="col2">Name</li> <li class="col3">Email</li> <li class="col4">Line Manager</li> </ul> </HeaderTemplate> <ItemTemplate> <ul> <li class="col1"> <%# DataBinder.Eval(Container.DataItem, "UserId") %> </li> <li class="col2"> <%# DataBinder.Eval(Container.DataItem, "Name")%> </li> <li class="col3"> <%# DataBinder.Eval(Container.DataItem, "Email") %> </li> <li class="col4"> <%# DataBinder.Eval(Container.DataItem, "Line Manager") %> </li> </ul> </ItemTemplate> </telerik:RadComboBox>C#
protected void UserID_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) { List<User> searchResults = null; //AD Search (uncomment to test) ADSearch ads = new ADSearch(); searchResults = ads.SearchAD(UserIDComboBox.Text, UserName, Password); if (null == searchResults) { UserIDComboBox.Text = "No User Found"; } else { foreach (User adu in searchResults) { "UserID field" = adu.UserId; "Name field" = adu.Name; "Email field" = adu.Email; "Manager field" = adu.Manager; } } } protected void UserID_ItemsDataBound(object sender, RadComboBoxItemEventArgs e) { e.Item.Text = ((DataRowView)e.Item.DataItem)["UserId"].ToString(); e.Item.Text = ((DataRowView)e.Item.DataItem)["Name"].ToString(); e.Item.Text = ((DataRowView)e.Item.DataItem)["Email"].ToString(); e.Item.Text = ((DataRowView)e.Item.DataItem)["Manager"].ToString(); }