i am binding two table values in AutoCompleteExtender but my requirement is differentiate the two tables apply the colors i.e table1 values apply red color and table2 values apply green color how to write the code pls give me any suggestion
my code is
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
DataTable dt = GetRecords(prefixText);
List<string> items = new List<string>(count);
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i][1].ToString() + ',' + dt.Rows[i][0].ToString();
items.Add(strName);
//items.Add(System.Drawing.Color.Red);
}
return items.ToArray();
}
Getrecords code is
public DataTable GetRecords(string strName)
{
SqlCommand cmd = new SqlCommand("Usp_Consultant1", LITRMSConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@consultantname", strName);
DataSet objDs = new DataSet();
SqlDataAdapter dAdapter = new SqlDataAdapter();
dAdapter.SelectCommand = cmd;
LITRMSConnection.Open();
dAdapter.Fill(objDs);
LITRMSConnection.Close();
return objDs.Tables[0];
}
and stored procedure is
CREATE Procedure Usp_Consultant1
(@consultantname varchar(100))
As
Begin
select (cast(ConsultantID as varchar)+',Employee')as ConsultantID,(FirstName+LastName)as ConsultantName from Consultant where FirstName+LastName like +@consultantname+'%'
union all
select (cast(ConsID as varchar)+',NonEmployee')as ConsultantID,(Firstname+LastName)as consultantName from InDirectConsultant where FirstName+LastName like +@consultantname+'%'
ORDER BY 1;
End
pls give me any suggestion….
thank u
hemanth
answer is add the javascript function