Showing posts with label autocompleteextender. Show all posts
Showing posts with label autocompleteextender. Show all posts

Wednesday, March 28, 2012

How do I modify the AutocompleteExtender?

I want to extend the AutoCompleteExtender so that a if the search returns a large number of results, the first 10 results are displayed and the user is given some indication that there are additional matching results, with the option for them to fetch more results. Can anyone give me any pointers as to how to get started with this as I'm new to Atlas?

Hi,

I think it will be difficult to accomplish this task with the AutoCompleteExtender since it's not possibile to pass additional paramters to the auto-complete service method.

Thanks for the reply Garbin.

That seems a real shame since the nature of my application means that unless I can provide this functionality the AutoCompleteExtender is not going to be any use to me... back to the drawing board I guess!

How do I modify the AutocompleteExtender?

I want to extend the AutoCompleteExtender so that a if the search returns a large number of results, the first 10 results are displayed and the user is given some indication that there are additional matching results, with the option for them to fetch more results. Can anyone give me any pointers as to how to get started with this as I'm new to Atlas (and the toolkit)?

This question doesn't involve the Atlas Control Toolkit; please try asking on one of the Atlas forums instead! Thanks!

Saturday, March 24, 2012

How can I use bridging with AutoCompleteExtender?

I would like to use external webservice to get data in AutoCompleteExtender instead of having local .txt file as specified in ATLAS documentation/exmples.

.asbx is correctly registered in IIS. I have created a bridge file ServerAutoComplete.asbx like...

<?

xmlversion="1.0"encoding="utf-8" ?>
<bridgenamespace="Samples.AspNet"className="BridgeServerAutoComplete" >
<proxytype="CatalogReader, App_Code" />
<methodname="GetWordList">
<input>
<parametername="prefixText"/>
<parametername="count" />
</input>
</method>
</bridge>

where CatalogReader is class of my webservice which is hosted on another server.

I have following settings in my ServerAutoComplete.aspx page forScriptManagerandAutoCompleteExtender.

<atlas:ScriptManagerID="AtlasPage1"runat="server">
<Services>
<atlas:ServiceReferencePath="~/ServerAutoComplete.asbx"/>
</Services>
</atlas:ScriptManager>

...

<

asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<atlas:AutoCompleteExtenderID="autoComplete1"runat="server">
<atlas:AutoCompletePropertiesEnabled="True"MinimumPrefixLength="1"ServiceMethod="GetWordList"ServicePath="ServerAutoComplete.asbx"TargetControlID="TextBox1"/>
</atlas:AutoCompleteExtender>

...

Now when I run ServerAutoComplete.aspx page I am not getting any AutoComplete words.

My question is how can I set this whole set-up working? How can I set parameters of webservice method from AutoCompleteProperties?

Am I missing any step?

Thanks,

Vishant

Hi Vishant,

So the easiest way for you to pass parameters to the bridge in this scenario would be on the query string.

First you'll need to enable get for your bridge service, which you can do by adding:

<methodname="GetWordList" getEnabled="true">

Now you can hit the bridge using a url like: http:yourserver/ServerAutoComplexe.asbx?mn=GetWordList&prefixText=<text>&count=<count>, you should verify that using the browser and make sure that you get some JSON back...

That being said, I'm not sure there's an easy to pass these on the query string from AutoComplete. The best option would be to add a <binding> for the serviceUrl of the autocompleteproperteries where you specify a custom javascript transform method, i.e. transform="GetServiceUrl", and this method returns "ServerAutoComplete.asbx?prefixText="+document.getElementById("TextBox1").value and you also add the count parameter in there as well.

That should work, I think...

Hope that helps,
-Hao


Hi Hao,

Thanks for your reply.

I enabled "get" on my bridge service as you have mentioned but when I hit browser with "http:yourserver/ServerAutoComplexe.asbx?mn=GetWordList&prefixText=<text>&count=<count>" it does not give any JSON. Is this the exact syntax should I use?

I also could not find</binding>tag anywhere in documentation. Is this new tag forAutoCompleteProperties? I put it as shown below but no result.Does this syntax is correct?

<atlas:AutoCompletePropertiesEnabled="True"MinimumPrefixLength="1"ServiceMethod="GetWordList"ServicePath="~/ServerAutoComplete.asbx"TargetControlID="TextBox1">
<bindingtransform="GetServiceUrl"></binding>
</atlas:AutoCompleteProperties>

I know I am asking too much but I am new to ATLAS and JSON. It would be great if you can please provide step by step instruction or syntax?

Vishant


So you'll want to hit the real URL of your server with the browser, not http:yourserver..., you'll also want to give real data to your service.

Taking a step back, what is does your ServerAutoComplete.asbx look like?

But the real situation is that currently the AutoCompleteExtender does not really have a good story for hitting a bridge rather than an explicit webservice as its expecting, the option I listed above is more of a workaround/hack given the existing situation.

Hope that helps,
-Hao