About Tim

  • Website: or email
  • Biography:

Posts by Tim:

 
0

JQuery 1.6+ attr and prop issue

On May 16, 2011 in jQuery

I used the following code to make sure all radio buttons where unchecked and the current one was set correctly. This worked well before jQuery 1.6.

$(document).ready(function() {
SetUniqueRadioButton = function(current, id) {
jQuery("input[type=radio]").each(function() {
$(this).attr("checked", false);
});
current.checked = true;
};
});

Since jQuery 1.6, this code did not work and after doing some digging around, I found that you need to use the new method .prop() to get the code functioning correctly again.

$(document).ready(function() {
SetUniqueRadioButton = function(current, id) {
jQuery("input[type=radio]").each(function() {
$(this).prop("checked", false);
});
current.checked = true;
};
});

Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() only retrieves attributes.

References:

http://api.jquery.com/prop/

Tags:

 
0

Finding StoreGeneratedPattern value in EdmProperty in T4 Template

On May 11, 2011 in .NET Framework, C#, SQL Server

If you need to find out if a primary key in your conceptual model which is using the Identity value from the property StoreGeneratedPattern, you can use the following code: (NOTE: This is used within a T4 template) string inputFile = @"..\EntitiesModel.edmx"; EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile); string annotationNamespace = "http://schemas.microsoft.com/ado/2009/02/edm/annotation"; foreach (EntityType entity in ItemCollection.GetItems<EntityType>().OrderBy(e [...]

 
0

Back to Basics – Deleting Cookies using ASP.NET

On May 11, 2011 in .NET Framework, ASP.NET

You cannot instruct ASP.NET to physically remove cookies from the user’s computer so you have to tell the user’s browser to modify the cookie in order to trigger the browser to remove the cookie. See code example: HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i=0; i { cookieName = Request.Cookies[i].Name; aCookie = [...]

 
0

handling multiple submit buttons in one form (asp.net webforms)

On May 6, 2011 in ASP.NET

I came across an issue where I had the following setup with an asp.net website: I had a master page with one main form element I had a submit button in the master page which acts as a search button across the website I had a login page that also has a submit button Naturally [...]

 
0

Off to Wellington

On April 1, 2011 in News

Its been sometime updating this blog due to well being busy (as usual) and being caught up in the 22nd Feb Earthquake in Christchurch.   Just a bit of an update of what we are doing and where we are heading. Firstly we are relocating to Wellington where Tim will spend his time during the day [...]

 
0

Compiler Error Message: CS1973

On February 6, 2011 in MVC

I came across this error when I was trying to use the @Render method to render a view while passing through a object that will act as the model for that view. Compiler Error Message: CS1973: ‘System.Web.Mvc.HtmlHelper’ has no applicable method named ‘Render’ but appears to have an extension method by that name. Extension methods [...]

 
1

Disabling Request Validation with ASP.NET MVC

On February 1, 2011 in C#, MVC

Sometimes when dealing with POSTS and form data, you need to disable Request Validation to allow HTML/scripting data into your methods.   Traditionally with Web Forms you use <%@ Page ValidateRequest=”false” %> which turns off Request Validation, just be aware that this doesn’t work with ASP.NET MVC. You apply the [ValidateInput] attribute to the controller action [...]

 
1

New Windows Phone 7 App coming soon

On October 29, 2010 in News, Windows Phone 7

We have been developing a new Windows Phone 7 application called “Prepare Yourself” which will be in the marketplace very soon.   The application helps you track items that you should have in your survival kit in case of a natural disaster.   You can view the demo here

 
0

Determing SQL Server Table Size

On September 3, 2010 in SQL Server

This is a bit of code I found that determines the size used by each table in your database. Make sure you run DBCC UPDATEUSAGE first to correct any incorrect stats (pages etc) on your tables. DBCC UPDATEUSAGE (YOUR DATABASE NAME) DECLARE @TableName VARCHAR(100)    –For storing values in the cursor –Cursor to get the [...]

 
0

You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient

On August 26, 2010 in .NET Framework, SQL Server

The problem I got the following random error: You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient The Solution Its a known bug with the .Net SqlClient Data Provider.   If you have a field in the database of type nvarchar(max) [...]

Copyright © 2008-2012 Codelab Blog All rights reserved.
Desk Mess Mirrored version 1.9.1 theme from BuyNowShop.com.