Feedback Form

Thursday, June 19, 2008

Disable or stop AutoCompleteExtender (Javascript)

To disable or stop the AutoCompleteExtender from running or calling its service to load auto suggested list, (Using Javascript)

Its very simple

-Set the BehaviorID property for the AutoCompleteExtender

<ajaxToolkit:AutoCompleteExtender
runat="server"
ID="autoSuggest"
TargetControlID="SearchBox"
ServiceMethod="GetSuggestedList"
ServicePath="~/_Services/AutoSuggest.asmx"
MinimumPrefixLength="2"
CompletionInterval="1"
EnableCaching="true"
CompletionSetCount="10"
CompletionListCssClass="AutoSuggestSearch"
CompletionListItemCssClass="listItem"
CompletionListHighlightedItemCssClass="highlightedListItem"
BehaviorID="autoSuggest"
/>



Then using javascript just write:




function selectType()
{
var a = $find("autoSuggest");
a.set_serviceMethod('');
}


By setting the service method to empty, the autosuggestextender will not find the service to call and will stop working

kick it on DotNetKicks.com

Tuesday, June 17, 2008

Window.open invalid argument

Just a hint about a simple problem could happen to you while writing javascript code to open a new browser window using window.open, it may give you the following error message box

windowopenerror

in case you wrote it like that:

window.open("http://www.google.com", "This Is My Page", "status=1, width=300,height=500");

where is the wrong argument?

its the name argument "This Is My Page"

You can write it like that (without spaces):

window.open("http://www.google.com", "ThisIsMyPage", "status=1, width=300,height=500");

Note:

It wont give you any errors in firefox in both cases, this error just happen in IE.

window.open good article


kick it on DotNetKicks.com