Intellisense in Text box

Posted by Toashish80 under ASP.NET on 4/21/2010 | Views : 4536 | Status : [Member] | Replies : 5
I have a text box which will be used for entering some alphanumeric value. I want to buid intellisense in the text box such that when user enters some value then based on the options available from the database it should display a list of options from where user can choose.




Responses

Posted by: Muhilan on: 4/21/2010 [Member] Starter

Up
0
Down
use Ajax Auto Complete Control for your requirement,want to know more about auto complete control go through the link http://www.asp.net/ajaxlibrary/act_AutoComplete.ashx

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhilan on: 4/21/2010 [Member] Starter

Up
0
Down
see this also http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/AutoComplete/AutoComplete.aspx

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 4/21/2010 [Member] Starter

Up
0
Down
I tried using the same. I have taken the service method path as the aspx name. In the public function I am returning 2 strings.
When I am building the application and entering the first 2 characters its not giving me any popup. Can you provide some sample code for the Service Method.

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhilan on: 4/21/2010 [Member] Starter

Up
0
Down
create webservice for your DB

ex..


[WebMethod]
public string[] Information(string prefixText)
{
int count = 10;
string sql = "Select * from t.b Where column_Name like @prefixText";
SqlDataAdapter da = new SqlDataAdapter(sql,"Your Connection String Comes Here"));
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText+ "%";
DataTable dt = new DataTable();
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Country_Name"].ToString(),i);
i++;
}
return items;
}


call the above webservice method in extender method

ServicePath="WebService.asmx"

ex..

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="Information" ServicePath="WebService.asmx" TargetControlID="TextBox1"> </cc1:AutoCompleteExtender>


Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 9/14/2010 [Member] Bronze | Points: 25

Up
0
Down
hi
if windows application then follow below link...

http://santoshdotnetarena.blogspot.com/2009/10/in.html


Regards
Santosh

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response