Images not displaying in autocomplete list of ASP.Net AJAX AutoCompleteExtender

Last Reply on Mar 21, 2017 09:07 AM By micah

Posted on Mar 21, 2017 01:47 AM

My AjaxComplete not showing image, its only showing the usernames and names


    public static List<string> SearchEmployees(string prefixText, int count)
        using (SqlConnection conn = new SqlConnection())
            conn.ConnectionString = ConfigurationManager
            using (SqlCommand cmd = new SqlCommand())
                cmd.CommandText = "select UserName,UserId,Name from User3 where " + "UserName like @SearchText + '%'";
                cmd.Parameters.AddWithValue("@SearchText", prefixText);
                cmd.Connection = conn;
                List<string> Searchusernames = new List<string>();
                using (SqlDataReader sdr = cmd.ExecuteReader())
                    while (sdr.Read())

                       .CreateAutoCompleteItem(string.Format("{0} {1}", sdr["Name"], sdr["UserName"]), sdr["UserId"].ToString()));
                return Searchusernames;


<div class="input-group">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods = "true">
    <asp:TextBox ID="txtContactsSearch" runat="server" class="form-control" placeholder="Search post..." Width="100%"></asp:TextBox>
    <asp:AutoCompleteExtender ServiceMethod="SearchEmployees"
    MinimumPrefixLength="1" CompletionInterval="100" EnableCaching="false" CompletionSetCount="10"
    TargetControlID="txtContactsSearch" OnClientPopulated ="usernames_Populated"
    OnClientItemSelected = "OnEmployeeSelected" ID="AutoCompleteExtender1" runat="server" FirstRowSelected = "false"></asp:AutoCompleteExtender>
    <span class="input-group-btn">
        <asp:LinkButton ID="LinkButton2" runat="server" class="btn btn-default" > 
            <i class="fa fa-search"></i>
You are viewing reply posted by: micah on Mar 21, 2017 09:07 AM.
Posted on Mar 21, 2017 09:07 AM

Hello, in added imagename to the select query and also removed .jpg extension in the query code and it worked..Thanks for helping