Wednesday, March 21, 2012

DropDownExtender question

Can I use the DropDownExtender to create a google suggest textbox? If not, is there another control i can use to do this, or do I have to build my own?

Thanks

sorry...what is google suggest textbox

http://www.google.com/webhp?complete=1&hl=en

The AutoCompleteExtender does what I want but I'm not sure how to send the textbox value to the webservice to sort the dataset. Here's my code...

 <asp:TextBox ID="txtTest" runat=server></asp:TextBox> <asp:AutoCompleteExtender ID=ace1 runat=server TargetControlID="txtTest" ServicePath="WebService.asmx" ServiceMethod="getZoneSuggestions" MinimumPrefixLength="1" />
[ScriptMethod] [WebMethod(EnableSession =true)]public string[] getZoneSuggestions(string test) {string[] result; result =new string[4]; result[0] ="atest1"; result[1] ="atest2"; result[2] ="btest2"; result[3] ="btest2";return result; }
When I try to pass the string into getZoneSuggestions nothing happens, but when I remove "string test" it will show all of my results.
 

I figured it out.

[ScriptMethod] [WebMethod(EnableSession =true)]public string[] getZoneSuggestions(String prefixText,int count) {string[] result; result =new string[4]; result[0] ="atest1"; result[1] ="atest2"; result[2] ="btest2"; result[3] ="btest2";return result; }

No comments:

Post a Comment