Posts by Tim:
JQuery 1.6+ attr and prop issue
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.
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.
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:
Finding StoreGeneratedPattern value in EdmProperty in T4 Template
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 [...]
Back to Basics – Deleting Cookies using 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 = [...]
handling multiple submit buttons in one form (asp.net webforms)
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 [...]
Off to Wellington
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 [...]
Compiler Error Message: CS1973
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 [...]
Disabling Request Validation with ASP.NET 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 [...]
New Windows Phone 7 App coming soon
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
Determing SQL Server Table Size
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 [...]
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 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) [...]


