Feeds:
Posts
Comments

Preventing people from submitting a form multiple times by repeatedly clicking the submit button can be done with a few settings. First you need to set the attribute “UseSubmitBehavior” to “false” and then add the following to the “OnClientClick” attribute: “this.disabled=true;”.

Example:

<asp:Button runat=”server” ID=”ButtonSave” Text=”Save” CausesValidation=”true” Enabled=”true”  OnClick=”ButtonSave_Click” OnClientClick=”this.disabled=true;” UseSubmitBehavior=”false” />

I was experiencing issues with the postback event not firing when disabling the button via the “OnClientClick” attribute. This could be fixed by setting the “UseSubmitBehaviour” attribute to false. After that the postback event was fired and the “ButtonSave_Click” function could do it’s magic.

Thanks to this blog I was able to make it work.

When you’re working on a web application the normal way of debugging is pressing F5, wait for the browser window to pop-up, test stuff and close the browser. By closing the browser you will stop debugging in Visual Studio.

I cannot remember the amount of times I accidentally closed the browser window and thereby stopped debugging the application. To prevent further irritation I’ve gotten the golden tip from one of my colleagues.

Go the the properties page of your web application. Click the ‘Web’ tab (as displayed in the image) and set the ‘Start Action’ to: Don’t open a page. Wait for a request from an external application.

When you  start debugging from within Visual Studio, no browser will be started but instead of that Visual Studio will automatically attach itself to the ‘aspnet_wp.exe’ worker process (CTRL + ALT + P is the manual way to attach the debugger to a process).

So open a browser window (if you haven’t got one open yet), browse to the local address of the web application you want to debug and you will notice it will hit the breakpoints just as intended.

That’s it!!!

I noticed last week I had to manually open the Output window in Visual Studio when building my solutions. This has been irritating me a lot lately so I decided to figure out why it isn’t showing when building.

The only thing you need to do is to tick the check box in Tools -> Options -> Projects and Solutions -> ‘Show Output window when build starts’ and it should pop-up the next time you press CTRL + SHIFT + B or F6 in Visual Studio.

A handy feature in Visual Studio, which is not enabled by default, is to track the current open item in the Solution Explorer.

You can enable that feature by going to Tools -> Options -> Projects and Solutions -> Track Active Item in Solution Explorer.

This is a handy feature, especially when you have many open files and you need to locate the file in the Solution Explorer.

If you activate the document via the tab, the Solution Explorer will jump to the file and highlight it.

“Comments off”

Due to a setting, all comments on posts older than 2 weeks were automatically disabled.
My bad, I fixed it.

Please feel free to leave a comment on any post I’ve made ;-)

This error was shown to me when I tried to import an Excel Spreadsheet into a Microsoft SQL Server 2005 database using the SQL Server Integration Services (SSIS) wizard.

After trying to fix the issue by copying the data from one Excel sheet to a new one and all other kind of tricks I found this blog post about this on the Bite The Wax Tadpole blog.

There I found the following paragraph:

The data types of the Excel Source External Columns are automatically determined by SSIS based on sampling of the spreadsheet rows. For string columns if the sample does not reveal cells with greater than 255 characters, the data type is always DT_WSTR (Unicode string) which has maximum length 255. If the sample reveals cells with greater than 255 chars then the datatype will be DT_NTEXT (Unicode text stream).

So SSIS scans a few rows of the file and decides if a string column should be of the datatype DT_WSTR instead of DT_NTEXT.

Aha!! *lightbulb*

After reading through the rest of that post I decided to take the advice of converting the Excel spreadsheet to a flat file.

Importing the flat file made it a breeze and all of my data in the Excel spreadsheet was now also in SQL Server.

Today I tried to solve a issue with a CSS based menu. When hovering the top-menu a sub-menu would be shown as a drop-down. Right underneath the menu a nice looking flash movie was implemented on the page using SWFObject.

The code looks like this:

7 <div id=”flash”>

8 <h4>A new version of Adobe Flash Player is required.</h4>

9 <p>download</p>

10 </div>

11 <script type=”text/javascript”>

12 var s1 = new SWFObject(‘movie.swf’,‘movie’,’960′,’224′,’6′,‘#FFFFFF’);

13 s1.write(‘flash’);

14 </script>

The above code will overwrite the div with the “flash” id, if the correct Flash Player has been installed.

The Flash Player always writes the flash movie to the topmost layer of the page. This means menu’s will be shown ‘underneath’ the flash movie and therefore be invisible. Even z-index changes in the CSS file of your page will not be of any influence.

A simple solution to solve this is by passing a parameter to the SWFObject before writing it to the div. By passing the ‘wmode’ parameter with the ‘opaque’ value to the object, the flash object won’t be shown ‘on top of’ the CSS-based menu. Instead the menu will be visible again.

The new code:

7 <div id=”flash”>

8 <h4>A new version of Adobe Flash Player is required.</h4>

9 <p>download</p>

10 </div>

11 <script type=”text/javascript”>

12 var s1 = new SWFObject(‘movie.swf’,‘movie’,’960′,’224′,’6′,‘#FFFFFF’);

13 s1.addParam(‘wmode’,‘opaque’); //this parameter is needed to show the sub-menu

14 s1.write(‘flash’);

15 </script>

So next time when you encounter issues using CSS based menu’s, SWFObject and  flash movies, be sure to check if you’ve set the ‘wmode’ to ‘opaque’.

In the last few month’s I’ve bought some books to help me improve as a developer. One of them is Code Complete 2nd Edition by Steve McConnell. It is full of best practices, practical suggestions and methods for either a new developer or a veteran in software development.

I’ve not yet completed reading the entire book (it’s quite a thick book) so I will review the book in the near future.

Learning

I’ve decided to pick up my quest for certification and try to get a Microsoft certificate for ASP.NET 3.5 Application Development. I already have an certificate for Microsoft .NET Framework – Application Development Foundation (70-536). So the upcoming months I will focus my spare time to studying for the Microsoft .NET Framework 3.5, ASP.NET Application Development (70-562) exam.

I already have the book so it’s just a matter of time before I’ve worked through all the exercises.

The IT business is changing and developing rapidly. As a developer, it requires a lot of effort to keep up with the latest technology. When I look at my own situation, being an ASP.NET developer, I often think about becoming a ‘better’ developer and what steps I need to take to keep up with the constantly changing and evolving IT business.

Step 1: Start listening to Podcasts

Since 2 years I’ve started listening to technology podcasts (.NET Rocks, Hanselminutes, Herding Code, Security Now! and The Stackoverflow Podcast). I have quite a long commute (2,5 hours per day, depending on the traffic it might be up to 4 hours) so listening to podcasts is a nice distraction when being stuck in a traffic jam.

Step 2: Start reading Blogs

About the same time I started listening to podcasts, I’ve subscribed to several blogs using Google Reader. My normal working day starts with reading some blog posts. By doing this I learn a lot about new technologies, and what people are working on.

Step 3: ‘Adopt’ a open source project

By taking the two steps I’ve described above, I feel much more up-to-date with what’s going on in the world of technology. Still I feel something is missing.

After reading an inspiring blog post by Phil Haack, I came to the conclusion that I am ready to take the ‘next step’. In this post, Phil talks about a person who contacted him and asked how he [Phil] became such a successful developer and what steps he had taken to become who he is now. A quote from his blog post:

If one thing in my career has paid dividends, it was getting involved with open source projects. It exposed me to such a diverse set of problems and technologies that I wouldn’t normally get a chance to work on at work.

What’s next?

Ok so I’ve decided to get involved with a open source project. Phil hints to his own project in his blog post.

Perhaps it is a good idea to look around and see what there is and what seems interesting to me.

In the following blog posts I will be discussing several open source project which of one I will probably adopt.

Older Posts »

Follow

Get every new post delivered to your Inbox.