Tuesday, March 18, 2008

How to get the current row in Gridview RowCommand event

Blogger Tags:

I've been working in a project where we use the Gridview control very often.

In this particularly case I need to get a reference to the current row of a gridview, in order to get some values that exists in several columns of the same gridview.

If we take a look at the signature of the method:

protected void GridView\_RowCommand(object sender, GridViewCommandEventArgs e)

you will notice that, at a first approach, in none of the parameters, we can get a reference to the current row.

Using the following single line of code, we can get a GridViewRow object referencing the current row.

GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;

The code above is not so elegant as I wish, but the world is not perfect as well. :)

We can now use the following code to get a reference to existing controls on the current GridView row.

DropDownList ddlPriority = row.FindControl("ddlPriority") as DropDownList;

int priorityID = ddlPriority != null ? Int32.Parse(ddlPriority.SelectedValue) : 0;

 

Problem fixed !!!

Saturday, March 15, 2008

Friday, March 7, 2008

TFS add-on list

If you are using Team Foundation Server, exists a set of tools that you should consider, at least take a look at them.

Bellow, you can find a list of my favorite ones, that i would like to share with you:

TFS File Sharer - Mimics SourceSafe like file sharing.

TFS Continuous Integrator - A TFS 2005 based continuous integration solution.  Of course, it's built in if you are using TFS 2008.

TFS Dependency replicator - A tool to make changes in the source tree when certain events occur (like copying files when a build completes).

TFS Build Virtualizer - Rather than having one physical machine for each team or build server configuration, manage a pool of virtual machines automatically.

SLR TFS Get Latest Version on Check-Out

Outlook 2003 TFS Addin

Team Foundation Server Administration Tool 

Team Foundation Server Event Subscription Tool

Team Foundation Server 2005 Power Tools - best practices analyzer, work item templates

Team Foundation Server 2008 Power Tools - command line tools, build notification, process template editor, custom check-in policy, best practices analyzer, work item templates

Feel free to suggest others.

TFS add-on list

If you are using Team Foundation Server, exists a set of tools that you should consider, at least take a look at them.

Bellow, you can find a list of my favorite ones, that i would like to share with you:

TFS File Sharer - Mimics SourceSafe like file sharing.

TFS Continuous Integrator - A TFS 2005 based continuous integration solution.  Of course, it's built in if you are using TFS 2008.

TFS Dependency replicator - A tool to make changes in the source tree when certain events occur (like copying files when a build completes).

TFS Build Virtualizer - Rather than having one physical machine for each team or build server configuration, manage a pool of virtual machines automatically.

SLR TFS Get Latest Version on Check-Out

Outlook 2003 TFS Addin

Team Foundation Server Administration Tool

Work Item Subscription Tool

Feel free to suggest others.

Thursday, March 6, 2008

CMMI - At what level am I?

Recently, I'm was making some research about CMMI. I work in a financial consulting company, that works mostly for banks. For some of them, specially outside Portugal, to work with them, they ask us for at least CMMI level 4.

We are just starting our CMMI certification path, and I was learning a lot about this. In an early future, I expect to post more things about this subject.

Below, i try to make a very small resume about CMMI.

CMMI stands for Capability Maturity Model Integration. and helps integrate traditionally separate organizational functions, set process improvement goals and priorities, provide guidance for quality processes, and provide a point for appraising current processes.
CMMI is not a process, is a model that describes the practices applied on effective processes.
The CMMI Framework the structure that organizes the components used in generating models, training materials and appraisal methods.
The CMMI Product Suite is the full collection of models, training materials and appraisal methods generated from the CMMI Framework.
The components in the CMMI Framework are organized into groupings, called constellations, which facilitate construction of approved models.
Basically, exists 3 constellations: CMMI-DEV that provides guidance for managing, measuring, and monitoring development processes. CMMI-SVC that provides guidance for delivering services within organizations and to external customers. And CMMI-ACQ that provides guidance to enable informed and decisive acquisition leadership. At Finsolutia, we are specially focus on CMMI-SVC and CMMI-DEV.

Next, I will share some links that can provides some useful information about CMMI.

The official website: http://www.sei.cmu.edu

Try this CMMI mini-survey, to get some information about your actual CMMI level. It produces a report with lots of information. It's a good start. 
Please, be honest when answering the questions :)  http://survey.cmmi.hu

Presentations
CCMI Version 1.2 Overview
CMMI for Development Version 1.2

Wednesday, March 5, 2008

Truncating the transaction log on SQL Server

Depending on the recovery model that you are using for your database, the size of your transaction log file may increase a lot.

If you would like to truncate and shrink the file, you can decide to use one of the follow options:

1. Make the full database backup.
2. Set the Truncate Log On Checkpoint database option and then run CHECKPOINT command from the Query Analyzer.
3. If the transaction log was not truncated, run the DUMP TRANSACTION command with NO_LOG parameter.
4. If the log was truncated, you can decrease the size of the log file by using the DBCC SHRINKFILE statement.
If the transaction log was not truncated, and the database have only one data file, detach the database by using the sp_detach_db stored procedure, then attach only the data file by using the sp_attach_single_file_db stored procedure. The transaction log will be recreated automatically with the small size. This is the example to detach/attach the Test database:

USE master
EXEC sp_detach_db 'Test', 'true'
EXEC sp_attach_single_file_db @dbname = 'Test', @physname = 'd:\data\Test_Data.MDF'

You can also stop the MSSQLServer service, drop the transaction log file, start the MSSQLServer service. The transaction log will be recreated automatically with the small size.


This is undocumented and not recommended way, so do not forget to make backup before.


Hope it helps!

Tuesday, March 4, 2008

Web Service Software Factory: Modeling Edition just released

The Web Service Software Factory: Modeling Edition (also known as the Service Factory) is an integrated collection of resources designed to help you quickly and consistently build Web services that adhere to well-known architecture and design patterns. These resources consist of patterns and architecture topics in the form of written guidance and models with code generation in the form of tools integrated with Visual Studio 2008.

Read more here http://msdn2.microsoft.com/en-us/library/bb931187.aspx

MSDN Code Gallery

Microsoft has launched a website where the developer community can download and share applications, code snippets, and other resources.

Check here if you can find what you are looking for, and I also encourage you to share something that others may think useful.

Technorati Tags: ,

AjaxControltoolkit v3.020229 Released

The community and Microsoft had released a new version of AjaxControlToolkit.

The version does not introduces nothing new, no new controls, but fixes some bugs on existent controls. This version also includes 10 patch fixes from community.

Major Fixes:

  • ValidatorCallout supports styling the popup using CSS and server-side validation.
  • ListSearch has enabled the options of searching for sub-strings in the list items and clearing the search query if no match is found.
  • AutoComplete only queries for matches when the user types a character.

AjaxControlToolkit on Codeplex