Changing the cursor using javascript in chrome without the mouse moving

May 21, 2010

I had a DIV html element absolute positioned, transparent and with an astronomical z-index.

Whenever I want to show that the web page is contacting the server and that the user should be patient I would change the css display value to the default and the cursor to progress. This stopped the user from causing other server requests like clicking on the same button multiple times while also giving them a sense that the application is working.

However in while in IE and firefox once I set display to none and the cursor back to the default the progress cursor would disappear, in chrome the progress cursor would remain until the cursor was moved by the user. This meant that the user might not be aware that the webpage request was complete and possibly eventually think that the application had crashed.

The solution was simple, change the z-index to -1 when the request was complete and chrome would behave as the other browsers had done previously.

  • Share/Bookmark

jQuery Context Menu appears off screen issue

May 18, 2010

jQuery Context Menu is available here: http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/

It’s a fantastic jQuery plugin that replicates most of the features that you’ll expect from any windows context menu.

A feature that I noticed was missing was what happens when you right click on the right and bottom edges of the screen. On windows the context menu appears to the left or above your cursor respectively, with the jQuery context menu plugin it appears off screen. Not exactly a big deal but here is the solution:

Continue Reading »

  • Share/Bookmark

Default Button in asp.net forms

May 17, 2010

Taken from http://www.metabuilders.com/Tools/DefaultButtons.aspx

Often in asp.net WebForms you have multiple buttons with a number of textboxes and other form controls making it difficult for the web browser to determine what should happen when a user clicks enter.

Thankfully in asp.net 2 the panel and form controls have a default button property making it so that the enter key for all form controls contained within the panel or form control triggers the default button specified.

  • Share/Bookmark

Updating Redirection using Strong Types to .Net 4

April 17, 2010

I wrote previously how to handle redirecting to other pages in an asp.net Web Forms application using the page’s type which allows you to move pages around in your site without having to worry about dead links as long as you use some sort of refactoring tool like resharper from jetbrains. Here is a link to the original post: http://www.lacy.ie/redirecting-using-strong-types-in-an-asp-net-web-application-project

In .Net 4 you are now able to have functions with optional parameters and name parameters in function calls, see http://weblogs.asp.net/paulomorgado/archive/2010/04/16/c-4-0-named-and-optional-arguments.aspx for more details on that.

So what this means for Redirecting using Strong Type is that where before you couldn’t specify which parameter you were referring to if two of the optional parameters were integers, now you can make both parameters optional and in your calls name the parameter you want to pass.

Continue Reading »

  • Share/Bookmark

How To Build VS2010 Solutions Using TFS2008 Team Build

April 14, 2010

This will work with .Net 4 RTM. It will also build previous versions of .Net Projects.

Step 1: Install the .Net 4.0 Framework Beta 2 on your build server (or just put VS2010 beta 2 on it)

Step 2: Change the Team Build config as follows

  • Stop the Team Build service
  • Go to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies and open up TfsBuildService.exe.config in the text editor of your choice.
  • Find the MSBuildPath setting and set the value as follows
    <add key=”MSBuildPath” value=”c:\windows\microsoft.net\Framework\v4.0.21006\” />
  • Restart the Team Build service and check that your builds work.
    Step 3: You’re done.  Go and ask your boss for a pay rise for being so efficient.

Taken from: http://richardsbraindump.blogspot.com/2009/11/how-to-build-vs2010-solutions-using.html

  • Share/Bookmark

Updating designer.cs in an ASP.Net Web Application

April 13, 2010

If the controls on your designer.cs are out of sync with your aspx page you may want to try the following to resync them.

Put your page in design view and right click / refresh. It will sync the controls with the designer.cs. Make sure designer.cs is close before doing this.

Taken from the following link: http://forums.asp.net/t/1233688.aspx

  • Share/Bookmark

How to stop a javascript event from bubbling

February 25, 2010

Events on any html document bubble from child up to parent calling the handlers on each element until it reaches the Body.

In order to stop this from happening you can cancel the bubble by setting the cancelBubble property on the event to true

<INPUT TYPE=”TEXT” NAME=”TEXT1″ onclick=”alert(‘TEXT1′);event.cancelBubble=true;”>Name

Taken from http://webdevelopersjournal.com/articles/jsevents2/jsevents2.html

  • Share/Bookmark

Reducing the size of your ViewState in asp.net web forms

February 22, 2010

Very useful article on how to reduce your ViewState size. Also very simple to implement.

http://szokelizer.blogsome.com/2006/11/09/how-to-put-controlstate-into-viewstate-and-how-to-put-viewstate-into-session/

  • Share/Bookmark

Using RegularExpressionValidator to validate the length of a String

February 15, 2010

This post I’ll keep short and sweet.

If you are using a Regular Expression Validator you will have the problem that if you use a line break it won’t validate when you write something like ^.{0,n}$ even though the dot is supposed to match anything

Apparently the dot isn’t supposed to match new line characters

I took the following from http://weblogs.asp.net/cosgood/archive/2003/05/06/6604.aspx although the wrong bracket is used to close off the cardinality

^(.|\s){0,n}$

That’s it, just remember to escape the backslash depending on where you are setting the expression.

  • Share/Bookmark

Redirecting using strong types in an asp.net web application project

January 13, 2010

Update, I recommend also reading the following post after you read this one if you plan on using this within .Net 4: http://www.lacy.ie/updating-redirection-using-strong-types-to-net-4

It recently began to annoy me that every time I want to redirect to a page I have to use a string. Not a big deal I know but when you have broken links it can reflect badly on you as a developer, so I began to look for some solution that would allow for the following.

  • Refactoring: I need to be able to move a page around without having to find every string reference to it
  • No Reflection: It’s slow I don’t want to have to use it when redirects happen often.
  • Parameters: I want to be able to pass parameters to a function and make that become part of the get request, I want the logic for that to exist on the page being redirected to as that is where the parameters are being used, this will also help with refactoring, the plain ole redirect logic however would just exist on a base class, don’t want to have to rewrite for every page.

I knew the ideal situation would be if I could somehow use the fact that web application projects use the folder hierarchy for its namespace convention and end up being able to redirect to the page ~/Users/UserDetails.aspx?UserId=14 with the following command Users.UserDetails.Redirect(14);

Here is how I did it: Continue Reading »

  • Share/Bookmark
 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org