I've had this problem many times in ASP.NET but never in SharePoint 2010. Today, one of our jQuery script implementations was failing on just a couple of the SharePoint pages - in particular the Publishing Portal Thumbnails Page.
All the jQuery objects were returning null values even though it worked for all the pages in the SharePoint site. The problem is back to that golden oldie of the jQuery object shortcut of $ conflicting with the Microsoft AJAX framework. Both frameworks use the $ as an object shortcut and so this causes problems. I almost felt nostalgic getting this exception :o).
Why does it only happen on a couple of pages in SharePoint 2010? They are the only ones which have script references to the MS AJAX javascript libraries.
There are ways around this using aliases (via the jQuery.noConflict() command) - but the simplest way is to just use jQuery as a best practice when working within SharePoint 2010 - with a find and replace of "$(" with "jQuery(" as needed. This fixed the problem.
Too easy!
DDK
The Musings and Findings of Software Consultant David Klein (Sydney, Australia)
Showing posts with label AJAX. Show all posts
Showing posts with label AJAX. Show all posts
Tuesday, 18 October 2011
Wednesday, 5 March 2008
A simple reminder to all: MS AJAX update panel and DataSources interaction - FormView.Update not passing values to DataSource
My Brazillian colleague Andre Gallo was having issues today with one of our datasources not being updated from an ASP.NET formview (a modified Object Container DataSource, part of the Web Client Software Factory package). While the formview had all the values (clearly visible via FormView.FindControl("myControlName"), a call to FormView.Updateitem() was not setting the value on the Object Container Data Source (aka OCDS). I had a look and the problem was that the datasource was OUTSIDE the AJAX panel - and so was not being passed through to the server by the partial postback.
There were 2 possible resolutions to that one:
There were 2 possible resolutions to that one:
- To put the object container datasource into the same panel
- To use the Telerik controls RadAjaxManager which allows you to point to specific trigger and destination controls for the partial postback.
We resolved the issue with option 2.
Labels:
AJAX,
ASP.NET 3.5,
Databinding,
DataSources,
Telerik
Wednesday, 10 October 2007
Contextual Autocomplete - aka AutoCompleteExtender that allows multiple input values
This handy package allows you to have 2 sources for your AutocompleteExtender. E.g you can use 2 textboxes to provide filters for the one autocomplete.
For more info and the download, see:
http://www.codeplex.com/websf/Wiki/View.aspx?title=Autocomplete_landing_page
For more info and the download, see:
http://www.codeplex.com/websf/Wiki/View.aspx?title=Autocomplete_landing_page
Friday, 5 October 2007
Microsoft AJAX Toolkit - using the AutoCompleteExtender without a web service
The AJAX Control Toolkit sample site instructions (http://www.asp.net/ajax/ajaxcontroltoolkit/samples/) do not make it clear that you can use the AutoCompleteExtender without a web service. This is possible without any additional coding. Here's the trick:
- Remove the ServicePath from the extender attributes altogether.
- Specify the name of your method in the ServiceMethod attribute,
- Add your method call to the script of the page itself. It will not work with a codebehind directly. For example:
Put this code in the page markup:
<script runat="server">
[System.Web.Script.Services.ScriptMethod]
{
return "this is sample text".Split()
}
</script>
Also make sure you set the service method to the function name and omit the ServicePath :
<cc1:autocompleteextender id="AutoCompleteExtender1" runat="server" behaviorid="AutoCompleteEx" targetcontrolid="txtOrderNumber" ServiceMethod="GetCompletionList" CompletionInterval="500" EnableCaching="true" CompletionSetCount="20" DelimiterCharacters=";, :">
Subscribe to:
Posts (Atom)