Thursday, June 22, 2006

CodeRush

So I am late to the party but they did a very nice job on CodeRush. I am hooked. Writing my own templates and spitting out code. If you haven't looked at Developer Express' CodeRush and Refactor! you are missing out on two great tools!

By the way I want to write a template to generate a method call where the first parameter is filled in with a different case in the third parameter -- on is local variable and the other is a SQL Server column name. Anyone want to help?

Friday, June 09, 2006

Client-Side Script Breaks Validators No More!

Recently I was using an image button with CausesValidation = true in an ASP.NET page. The inception also has an OnClientClick event and validators. What I discovered was that the client-side script caused an invalid validator to be ignored and the validation summary wasn't displayed. To fix this problem I tapped into the WebUIValidation.js file that gets referenced by ASP.NET pages. (Microsoft ships this javascript file with .NET.)

By manually checking WebUIValidation.Page_IsValid and calling WebUIValidation.ValidationSummaryOnSubmit() if the page is invalid the desired behavior--the validation summary--is now displayed correctly.

Here is the revised code:

function ImageSaveClick()
{
if( !Page_IsValid )
{
ValidationSummaryOnSubmit();
return false;
}
else
return window.confirm("Are you sure?");
}