U2U Blog

for developers and other creative minds


Localize your Control Toolkit controls

With the new release of the Control Toolkit, it is possible to localize your controls by doing almost nothing, thank you ASP.NET AJAX and Control Toolkit guys.

Just drag some Control Toolkit controls on your page, below the ScriptManager and set following properties in the ScriptManager:

  • EnableScriptGlobalization="true"
  • EnableScriptLocalization="true"


Why doesn’t the “Did you mean” work in the search

Today I had some problems with the "Did you mean" feature that you have when working with the search in MOSS.

For those who do not know what I'm talking about, this feature gives you a suggestion when you mistype a word in your search query. For example when you type 'offic', the search will suggest you 'Did you mean office'. This is a very cool feature, if it works.

After searching for a while and consulting Patrick, Patrick gave me the right answer ( thanks Patrick ) and the problem was my regional settings of my operating system. Apparently the 'did you mean' feature doesn't work with every language setting, especially not with my Dutch setting L, so I've changed it into English and everything worked fine.

Hope that this will save you from a headache and wasted time searching for the solution

Guidelines using SharePoint 2007

Maybe it is time to write down some guidelines that you should keep in mind while working with SharePoint 2007, or you could just ignore them as well. I found these guidelines in Blogs, articles on the internet but I wanted to group them together.



# site collections in a web application 


# sites in a site collection


# subsites nested in a site 


# lists 


# items in a list 


# documents in library 


# documents in folder


# documents in index


Maximum document file size

2 GB

# search scopes


# user profiles



These guidelines are not hard limits, meaning if you have 2005 lists on a site, your site will still work. The only thing that could happen by adding more items is that your performance could decrease.


Cancelling an Asynchronous Request

In my previous post I talked about the ScriptManager and the UpdatePanel. I showed you how you could make an asynchronous request to the server. Remember that not your whole page gets send to the server and back. The advantage of using asynchronous requests is that the user can continue working while your UpdatePanel is getting the new HTML from the server.

A thing you could do is adding a customization to your webpage while the update is in progress. For example you could add an animation to your page, or you could prevent your user to update a panel as long as the panel is busy with a previous request. You know them, those users who cannot wait and have the urge to click several times on the same button.

Well, let's give the user a nice waiting answer J.

You cannot use the Document Object Model to control asynchronous postbacks to the server. The thing that you need to use is the PageRequestManager class provided by the ASP.NET AJAX Framework. This class provides some events, methods and properties you can use while an update is in progress. Following is a list of event that you can use:

  • initializeRequest

    This event gets fired before the asynchronous request starts, this is the event that we are going to use to cancel a second postback.

  • beginRequest

    Raised before the processing of an asynchronous postback starts and the postback request is sent to the server.

  • pageLoading

    Raised after the response from the server to an asynchronous postback is received but before any content on the page is updated

  • pageLoaded

    Raised after all content on the page is refreshed as a result of either a synchronous or an asynchronous postback.

  • endRequest

    Raised after an asynchronous postback is finished and control has been returned to the browser.

So, as said, we are going to make use of the initializeRequest event to cancel an update. Lets switch over to some code.

First we need to create an AJAX Enabled website, which I showed you in my previous post. Once the project is created, we open the Default.aspx page and we are going to place an UpdatePanel on the page, under the ScriptManager.

For this example it is not important what you place in the UpdatePanel, just make sure you have a control that can fire a postback.

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">


    <%= System.DateTime.Now.ToLongTimeString() %>

    <asp:Button ID="UpdateButton" Text="Refresh Panel" runat="server" OnClick="UpdateButton_Click" />



To make sure we have enough time to start a second update, we are going to wait for five seconds by adding some sleep in our code behind, of course this depends on your clicking speed and the fact if you are an annoying user or not J.

    protected void UpdateButton_Click(object sender, EventArgs e)




Start your website and try it out, hit the button wait for five seconds. Now click 3 times on the button without waiting for five seconds, you will see that your page gets updated after 15 seconds, this is of course logic but it is not something that we want to happen.

The thing we need to do now, is getting (not creating) an instance of the PageRequestManager and register an event that gets fired when a new request occurs.

function pageLoad()




Now, we need to add code to the event. In our code we are going to verify if a request is currently busy and that the request is fired by our UpdateButton. If so, we are going to use the set_cancel method to cancel our new request.

function RequestingData(sender, args)


   var prm = Sys.WebForms.PageRequestManager.getInstance();

   if (prm.get_isInAsyncPostBack() & args.get_postBackElement().id == 'UpdateButton')



      alert('Patience ….');



Now againg start your website and click on the button.