I have a AutoCompleteExtender on my page which is made up of a nested masterpage. The Autocomplete works great however i can't seem to be able to apply styles to the CompletionListItemCssClass and the CompletionListHighlightedItemCssClass when i do i get
a horrible javascript error. The CompletionListCssClass works great, it's just the other two i am having problems with, and only when you hover over the second item in the list.
For a bit more detail the error i am receiving is
[Exception... "'Sys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null. Parameter name: className' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data:
no]. Also the CSS classes are being applied, i just get the error message which is a bit annoying.
Why have the AJAX Control Toolkit people decided to apply a separate style to each of them instead of just using css selectors e.g. ul > li > li a > li a:hover? This would load a lot faster and wouldn't need to the javascript to swap the css classes around.
Based on your description, I think that all the datas are returned to client correctly.So we shall first exclude the css aspect. Here is a workable sample. Please compare it with yours.
If it doesn't work, would you please give us more information. A workable and tiny repro would be appreciated.
Best regards,
Jonathan
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
CompletionListHighlightedItemCssClass property should be assigned, also please do not add .form prefix to autocomplete and item, or it won't affect your AutoCompleteExtender in your situation. For example,
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
Member
1 Points
35 Posts
AutoCompleteExtender Javascript Errors
Jan 02, 2008 06:13 PM|dtsn|LINK
Hi,
I have a AutoCompleteExtender on my page which is made up of a nested masterpage. The Autocomplete works great however i can't seem to be able to apply styles to the CompletionListItemCssClass and the CompletionListHighlightedItemCssClass when i do i get a horrible javascript error. The CompletionListCssClass works great, it's just the other two i am having problems with, and only when you hover over the second item in the list.
For a bit more detail the error i am receiving is [Exception... "'Sys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null. Parameter name: className' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]. Also the CSS classes are being applied, i just get the error message which is a bit annoying.
Why have the AJAX Control Toolkit people decided to apply a separate style to each of them instead of just using css selectors e.g. ul > li > li a > li a:hover? This would load a lot faster and wouldn't need to the javascript to swap the css classes around.
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="to"
ServiceMethod="GetCompletionList"
ServicePath="autoComplete.asmx"
MinimumPrefixLength="3"
EnableCaching="true"
CompletionListCssClass="autocomplete"
CompletionSetCount="10"
CompletionListItemCssClass="item"
>
</cc1:AutoCompleteExtender>
Thanks
DanielAll-Star
24409 Points
3416 Posts
Re: AutoCompleteExtender Javascript Errors
Jan 06, 2008 07:41 AM|Jonathan Shen – MSFT|LINK
Hi Daniel,
Based on your description, I think that all the datas are returned to client correctly.So we shall first exclude the css aspect. Here is a workable sample. Please compare it with yours.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
Member
1 Points
35 Posts
Re: AutoCompleteExtender Javascript Errors
Jan 06, 2008 09:52 AM|dtsn|LINK
Hi,
Thanks for the reply, I still can't seem to find the problem though. Heres some more code:
.form p { margin: 0px; padding:5px 0px 5px 0px; clear:both; }
.form > p:first-child { padding: 0px 0px 5px 0px; }
.form label { width: 100px; float:left; }
.form input[type="text"] { float:left; width: 200px; }
.form .error { float:left; background: url('/public/images/icons/error.gif') no-repeat 5px 3px; width: 20px; height: 20px; }
.form .buttons { clear:both; margin-top:10px; float:right; }
.form .autocomplete { margin:0px; padding:0px; background-color:#FFFFFF; list-style:none; padding: 5px 0px; z-index:99; }
.form .item { height: 17px; padding: 3px 5px 0px 5px; cursor:pointer; }
All-Star
24409 Points
3416 Posts
Re: AutoCompleteExtender Javascript Errors
Jan 06, 2008 09:19 PM|Jonathan Shen – MSFT|LINK
Hi Dtsn,
CompletionListHighlightedItemCssClass property should be assigned, also please do not add .form prefix to autocomplete and item, or it won't affect your AutoCompleteExtender in your situation. For example,
.autocomplete { margin:0px; padding:0px; background-color:#FFFFFF; list-style:none; padding: 5px 0px; z-index:99; }
.item { height: 17px; padding: 3px 5px 0px 5px; cursor:pointer; }
.itemHighLight{ color:White; background-color:#006699;cursor:pointer; }
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="to"
ServiceMethod="GetCompletionList"
ServicePath="~/AutoComplete/AutoComplete.asmx"
MinimumPrefixLength="3"
EnableCaching="true"
CompletionListCssClass="autocomplete"
CompletionSetCount="10"
CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="itemHighLight" >
</cc1:AutoCompleteExtender>
Best regards,
Jonathan
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
None
0 Points
2 Posts
Re: AutoCompleteExtender Javascript Errors
Mar 24, 2009 01:39 PM|bander87|LINK
You need to specify BOTH a CompletionListItemCssClass AND a CompletionListHighlightedItemCssClass
None
0 Points
6 Posts
Re: AutoCompleteExtender Javascript Errors
Jan 09, 2014 12:25 AM|vinayjade|LINK
thanks for this suggestion