August 06, 2007

UpdatePanelAnimationExtender - OnUpdating Will Always Play

Did you know that the when a partial postback starts, the OnUpdating animation for all of the UpdatePanelAnimationExtender's on the page will play.  Here is part of the documentation taken from the UpdatePanelAnimationExtender page It is important to note that because of the UpdatePanel architecture, the OnUpdating animation will always play when any partial postback starts, but the OnUpdated animation will only play at the end of a partial postback if its UpdatePanel was changed (note: setting the UpdatePanel's UpdateMode="Always" will ensure the OnUpdated animation plays when every partial postback completes). Unless I am mistaken, I believe this behavior is for the scenario where an UpdatePanel's UpdateMode is set to Conditional, and the code on the server handling the partial postback explicitly calls Update on the UpdatePanel.  In this case, where logic on the server decides if an UpdatePanel is refreshed, the UpdatePanelAnimationExtender has no way of knowing if it should have played the...

Comments (6) | TrackBacks (0)

July 07, 2007

View source for ASP.NET AJAX Web Service js proxy

Here is a quick tip that you might find helpful when working with the JavaScript proxy classes the ASP.NET AJAX ScriptManager server control auto-generates.  You can view the source for the proxy by entering the following url into the browser: http://[server]/[website]/[webservice].asmx/js  For example, assuming you have created an ASP.NET AJAX web site called SampleWebSite and within the web site there is a web service called SampleWebService, all you have to do to view the JavaScript proxy is navigate to: http://localhost/SampleWebSite/SampleWebService.asmx/js I recently wrote a post describing how ASP.NET AJAX web services can be used with the Microsoft Virtual Earth Map Control to create a nice web based map application (the article is here, the online demo is here).  You can view the JavaScript proxy for the web service I used to look-up the lat/longs for the zip-codes by clicking on the following link:  http://mattberseth2.com/virtual_earth_polygon/ZipCodeService.asmx/js ...

Comments (0) | TrackBacks (0)

June 20, 2007

EventHandlerList - Declaring .Net Events that Conserve Memory

Ever heard of the EventHandlerList object that lives in the System.ComponentModel namespace of the .Net framework?  I hadn't until I disassembled the System.Windows.Forms.Control class while debugging the other day.  I did a few google searches and ended up on an MSDN page titled 'How to: Declare Events That Conserve Memory Use'.  I found the content rather interesting.  Typically, a class declares an event as follows:public class Book { public event EventHandler PagedChanged; public void TurnThePage() { if (this.PagedChanged != null) { this.PagedChanged(this, EventArgs.Empty); } } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color:...

Comments (2) | TrackBacks (1)

May 30, 2007

Quick Tip: Order By 1 Desc

Did you know that instead of specifying the name or column alias in a SQL Server Order By expression you can optionally use an integer representing the position of the column name or alias within the select list you want to sort by.   So both of these queries return the same result set ...-- find me the last 10 log entries select top 10 * from adventureworks.dbo.databaselog order by databaselogid desc -- find me the last 10 log entries select top 10 * from adventureworks.dbo.databaselog order by 1 desc .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; }...

Comments (1) | TrackBacks (1)

April 25, 2007

Quick Tip: Use System.IO.Path.Combine instead of string concatenation

I came across a bug in our application the other day. The code at fault was very similar to the simple example below.  It assumed that the 'folderPath' argument the code in question was supplied with already had a trailing '\' character appended to the folder path.  Because this was not always the case, the code was failing.  The fix was simple – I replaced the string concatenation with a call to System.IO.Path.Combine. This method takes care of checking for this situation and handles it for you. The System.IO.Path class is loaded with other methods that are useful when doing common file system operations. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string[] folderPaths = new string[] { @"c:\folder\folders", @"c:\folder\folders\" }; string fileName = "fileName.txt"; foreach (string folderPath in folderPaths) { Console.WriteLine(Program.SmartFileStringBuilder(folderPath, fileName)); Console.WriteLine(Program.LessSmartFileStringBuilder(folderPath, fileName)); } // both print the samething: c:\folder\folders\fileName.txt, one...

Comments (2) | TrackBacks (1)

This Blog

  • Email Me
  • RSS
  • Atom
  • Entries - 102
  • Comments - 1276
  • Recent Comments

    • Chau wrote: Matt, I know its wrong to ask? Do you have black and gray version of the images? If would really h...
    • thombcoroemar wrote: Hi. Very interesting site! Thanks!...
    • ntulip wrote: i've followed your example and it seems that it doesn't work when your controls which expose the met...
    • Dave wrote: Anyone figure out the masterpage issue?...
    • rayzal wrote: Nice! i like it so much. Anybody here knows how to do it in PHP? Really appreciate any help :) thnks...
    • vitta wrote: Hi Matt.. I have the smillar requirement on navigating tabs on previous and next buttons. But I am...
    • Kabir wrote: Hi Matt I have been trying to implement this modal edit interface and i have been able to successful...
    • Gustavo Camps wrote: Excellent Blog!!!! is it possible to add Keyboard Navigation funcionality to vs2008 Lisview?...