Galin Iliev's blog

Software Architecture & Development

Prevent multiple clicks on Submit button in ASP.NET

Recently I had to solve very common problem: When users what to submit the page by clicking on Submit button very often they become inpatient and click the button again which results in another button OnClick event firing (and if you save db record) duplicating records in database.

The most obvious solution is to use JavaScript to disable submit button. Unfortunately this easy solution is not the best because of number of reasons - see Andy Smit's blog entry you don't want to disable buttons after they are clicked here for more details.

So I decided to use another approach : I won't disable button with I will hide it and I show div element with text that would calm user down :). Thus buttons are visisble according ASP.NET but parent HTML element hides them :)

this is the aspx code that declares buttons

<div id="divButtons" style="display:inline;">
   <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="buttons" OnClientClick="SubmitButtonClicked();return true;" OnClick="btnSubmit_Click" style="padding-left: 10; padding-right: 10;"></asp:Button>


   <input type="button" value="Cancel" onclick="javascript:top.hidePopWin(false);" style="padding-left: 10; padding-right: 10;"/>



<div id="divWait" style="display:none;">Note is being saved. Please wait respond from server...</div>                    


thus asp:Buttons controls fires SubmitButtonClicked(); javascript function before post the form.

Here is the js code:

function SubmitButtonClicked()


    if (typeof(ValidatorOnSubmit) == "function"){

        if (Page_ClientValidate() == false) {

            return false; }}


    $get("divButtons").style.display = "none";

    $get("divWait").style.display = "";


UPDATE: The function above is edited according the link below and all validators works as expected. :) Thanks John!

Although the bug I think it is good starting point.

You can see here for alternative solution -

SQL 2005 Analysis Service Performance Guide

For those of you who are interesed in MS SQL 2005 Analysis Services (SSAS) there is very hot (February 2007) new guide that deep dives into SSAS architecture and discuss how to optimize memory, CPU and disk usage.

Here is quick overview:

To satisfy the performance needs of various OLAP designs and server environments, this white paper provides extensive guidance on how you can take advantage of the wide range of opportunities to optimize Analysis Services performance. Since Analysis Services performance tuning is a fairly broad subject, this white paper organizes performance tuning techniques into the following four segments.

Enhancing Query Performance - Query performance directly impacts the quality of the end user experience. As such, it is the primary benchmark used to evaluate the success of an OLAP implementation. Analysis Services provides a variety of mechanisms to accelerate query performance, including aggregations, caching, and indexed data retrieval. In addition, you can improve query performance by optimizing the design of your dimension attributes, cubes, and MDX queries.

Tuning Processing Performance - Processing is the operation that refreshes data in an Analysis Services database. The faster the processing performance, the sooner users can access refreshed data. Analysis Services provides a variety of mechanisms that you can use to influence processing performance, including efficient dimension design, effective aggregations, partitions, and an economical processing strategy (for example, incremental vs. full refresh vs. proactive caching).

Optimizing Special Design Scenarios – Complex design scenarios require a distinct set of performance tuning techniques to ensure that they are applied successfully, especially if you combine a complex design with large data volumes. Examples of complex design components include special aggregate functions, parent-child hierarchies, complex dimension relationships, and “near real-time” data refreshes.

Tuning Server Resources Analysis Services operates within the constraints of available server resources. Understanding how Analysis Services uses memory, CPU, and disk resources can help you make effective server management decisions that optimize querying and processing performance.

It is so fresh so it requires SQL Server 2005 SP2 in order to performance tuning techniques.

Download Microsoft SQL Server 2005 Analysis Services Performance Guide

Remote Desktop MMC Snap-in in Windows Vista Trick

I use Virtual PC and Remote Desktop Connection (RDC) a lot in my daily acitivities.

Recently I found that there is very nice tool built-in Windows that allows you to manage miltiple RDC.

You can start this MMC console by typing in Run command window (Win+R) tsmmc.msc.

for more detailed way to display RDC MMC Snap-in see MS TechNet's Add the Remote Desktops snap-in article.

So far so good. But I am running Windows Vista on my laptop so I need to use on it.

But guess what?! I tried it in similar way as described in Add the Remote Desktops snap-in but I was not able to add this snap-in. There is no such file as tsmmc.msc.I found this thread in TechNet forums saying there are bunch of dlls in vista that need to be registered using regsvr32 in order to be used. Unfortunately even after registering these dlls I was not able to access RDC MMC snap-in.

So I decided to try in hard way :)

After some DLL research I copied mstsmmc.dll from Windows 2003 machine to my vista box and  registered using following command:

regsvr32 mstsmmc.dll 

and Bingo. That's it. There is Remote Desktops snapp-in in the list

and of course you are able to start tsmmc.msc (also copied from Win 2003 machine)

You can download these files from the link below. Enjoy (75.47 KB)

Slovenia currency sign in Vista?

Probably most of you know that Slovenia joined the Euro zone in the beginning of 2007 and official (and the only currency since about Jan 10th) became Euro.

According Andrej Tozon's post Microsoft are prepared for this :)

I am wondering where is Bulgaria on MS map as Sofia has been stated in GMT+1 time zone for very long time. I hope we are becoming more visible with each year.