C# String.Format token replacement for JavaScript
I use this for really simple token replacement. It may not work in all cases. JavaScript Function: function formatString(str) { for(i = 1; i < arguments.length; i++) { str = str.replace('{' + (i -...
View ArticlejQuery 1.5 RC 1 Released
jQuery 1.5 is almost ready! We’re nearing the final release of jQuery 1.5 – and we’re pleased to announce the release of the first release candidate! Barring any major bugs this should be the...
View ArticlejQuery Infinite Scroll with MVC 2
The inspiration for this post came from answering a question on Stack Overflow: jQuery Infinite Scroll and Gridview Controller: /// <summary> /// GET: /Widget/Search/ /// Displays search results....
View ArticleCross browser keypress event handling
Running example on JSFiddle: $(document).ready(function () { $("#TextBox1").live('keypress', function (e) { var kCode = e.keyCode || e.charCode; //cross browser check //Mozilla and Safari define...
View ArticlePostback UpatePanel on close of jQuery dialog
Put a hidden asp:button within the UpdatePanel or outside and set it as an AsyncPostBackTrigger. Call the js function from ItemDataBound if needed, passing in the ClientID of the hidden asp:button....
View ArticleBuilding a demo chat app in MVC3, backbone.js and a little SignalR for fun…
I have been doing a lot of reading lately on backbone.js. One of the key features I wanted to explore was it’s concept of Models and how it keeps the server side in sync with RESTful JSON endpoints....
View ArticleUsing ucajax to render UserControls via WCF
I recently released an open source project called ucajax hosted on GitHub and also available via NuGet. The project’s main purpose is to render ASP.NET UserControls via web services, currently...
View ArticleHow to get script tags with jQuery .find from ajax result
$.ajax({ type: "GET", dataType: 'html', contentType: 'application/x-www-form-urlencoded', url: '/url', success: function (data) { //have to replace script or else jQuery will remove them var...
View ArticleHow to set the ASP.NET Form Action with jQuery Mobile AJAX requests that...
A major problem I have had with using ASP.NET and jQuery Mobile is that jQuery Mobile turns most requests into an AJAX call. It’s very cool, and it is the crux of the framework, also is what makes it...
View ArticleSupporting WebForm Postbacks in a Non-WebForms application
This is a little crazy but it does work. I have a mobile application framework to uses a couple legacy ASP.NET controls. I had a need for them to support postbacks. The real problem I have is that I...
View Article