Auto-Suggested Textbox like google auto suggest
by V2FyYW4 » Sat, 22 Apr 2006 07:17:02 GMT
I need to create a Auto suggests Textboox like in
http://www.**--****.com/
I have completed this using AJAX.NET for Framework 1.1 . I have some design
issues after the data is populated.
For me the problem is I am getting more space after the item is selected.
And the items are displayed in a combo when i am going for another search /
selection without refreshing the page.
I am expecting a same output as google's auto suggested textbox.
see my work at http://www.**--****.com/
Please let me know if you get any on this.
The below is the javascript which helps to display the text box and the combo
//matches select
var matcheList = document.getElementById("matches");
//called by the onKeyUp javascript event on the input
function FindMatches(searchCriteria)
{
if (searchCriteria)
{
//SearchComplection is defined by Ajax.Net because that's the name of
the type we registered
NewOrder.FindMatches(searchCriteria, FindMatches_CallBack);
}
else
{
//clear the states dropdown
matcheList.style.visibility = "hidden";
}
}
//callback we told Ajax.Net to pass the response tos
function FindMatches_CallBack(response)
{
//if the server side code threw an exception
if (response.error != null)
{
alert(response.error); //we should probably do better than this
return;
}
//if we didn't get what we expect, or didn't get any matches
if (!response.value || response.value.length == 0)
{
matcheList.style.visibility = "hidden";
return;
}
matcheList.style.visibility = "visible";
matcheList.options.length = 0; //reset the states dropdown
matcheList.size = response.value.length; //dynamically set the size of
the select box
for (var i = 0; i < response.value.length; ++i)
{
matcheList.options[matcheList.options.length] = new
Option(response.value[i]);
}
}
//called when a match item is selected from the list
function MatchSelected(matches)
{
var state = document.getElementById("state");
var divDisp = document.getElementById("divList");
state.value = matches.options[matches.selectedIndex].text;
matcheList.style.visibility = "hidden";
//document.frmOrder.txtPClaimNo.focus();
matcheList.style.height="40px"
divDisp.style.visibility = "hidden";
selected = matcheList.options.selectedIndex;
value = state.value
if (selected !=0 || selected ==0)
{
count=3
for (var i = 0, oldpos = -1; i<count-1; i++)
{
pos = value.indexOf(',',oldpos+1);
data = value.substring(oldpos+1,pos);
frmOrder.elements['txtC' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
frmOrder.elements['txtC' + i].value =
value.substring(oldpos+1,value.length)
}
}
Thanks
Kumar
Similar Threads:
1.Limiting Auto suggest dropdown
2.how to make VS auto suggest properties during dev
After a year and a half of not touching ASP.NET, I have finally talked my
company into letting me build a useable app in .NET instead of classic. Now
I have to play catch up. i would really appreciate answers to the following
(hopefully easy) questions.
I have the web created (well, in dev) and the pages process fine. How can I
get VS (2003) to auto suggest properties for web controls. For example, I
created a new page called junkpage.aspx (outside of VS, direct into folder
where web pages exist). When I open the page in VS, and start typing
something like :
<asp:label id="mylabel" "
At this point I would expect VS to pop up a list suggesting all of the
properties of a label such as forecolor, text etc. On my pages however,
there is nothing. Also, in the left pane where the "toolbar" is, there are
no server controls. Just regular HTML which if you drag into the aspx page,
simply put in HTML instead of the server control (for example, Select
instead of DropDownList).
What am I missing here?
thanks
Rick
3.auto complete, spell and suggest
Hi,
I have to develop search text box feature in our web system. It should
support 3 features:
1. Auto-complete, means it should propose list of values during user
typing.
2. Spell checking, means propose most appropriated values even when
user typed mistake.
3. Suggest, means after search it should give "did you mean X" note,
like in google search
Of course all the 3 features should be based on data from our
database.
The web system developed on top of Microsoft technologies like
ASP.NET, Silverlight and MSSQL.
Can you please suggest some 3rd party that can help me with this?
Thanks,
Maxim.
4.auto suggest dictionary
I have a windows mobile 5.0 device, and an application written in .net cf
2.0. Is there a way to use a custom dictionary for auto suggest feature in
text boxes? I have looked everywhere but cannot find the dictionary...
Any and all help is greatly appreciated!
Thanks,
Bryan
5.Auto Complete/Suggest (On Steroids)
6. LiveSearch/Google Suggest asp.net component
7. "Google Suggests" and the AJAX .NET Wrapper?
8. google suggest, how can I do this?