[Serializable] DB.NET

.NET development and more (or less)

/// <summary>
/// Daniel Balla's Weblog - Various posts 
/// on .NET Development, ASP.NET, Agile, 
/// TDD, Architecture, SQL and others.
/// </summary>
[Serializable]
class Blog<T> where T : ASP.NET, Ajax, WCF, WF, new()
{
}

Thursday, March 29, 2007

Google apps - cheap alternative to mail server upgrade

This is sort of old news, but still worth mentioning as it doesn't seem to be very popular at the moment.
Do you have a cheap, modest hosting and do you like gmail? If yes, then you will love this:
Google offers a free Google apps membership for "families and groups". What's the catch? Well, you can keep your cheap hosting but use the a google email server, with a 2 GB mailbox and all the features of a gmail-like webmail on top, for free. All you need to do is sign up and then change your MX records with your host's DNS (they will probably do that for you, most hosts do because at the end of the day it only means less traffic on their server).
I no longer use this because I got a better webhost this year, but I tried it and I loved it.

Labels:

Friday, March 23, 2007

Row level validation in a gridview

A couple days ago a friend asked me how can you make the ASP.NET validators validate the contents of a gridview at row level, so that each row works independently. For example, in the grid below use a requiredfieldvalidator on each row so that the Save button would validate the description textbox on the same row, but wouldn’t validate any of the other rows’ descriptions.



In this case, clicking the save button in the “Dairy products” row would cause the validation to suppress the postback, but clicking the save button of any other row wouldn’t.
The solution is simple: use the validation group bound to a unique row identifier. In our example (which displays the contents of the Categories table of the Northwind database) the binding would look like:

(asp:TextBox Width="300px" ID="txtDescription" runat="server" Text='(%# Bind("Description") %)' /)
(asp:RequiredFieldValidator ID="reqDescription" runat="server" ControlToValidate="txtDescription" ErrorMessage="*" ValidationGroup='(%# Bind("CategoryID") %)' /)
(asp:Button ID="butSave" runat="server" Text="Save" ValidationGroup='(%# Bind("CategoryID") %)' /)

The parenthesis ( ) should be replaced with less-greater than signs < >, they are just a workaround the poor blogger’s editor.

Download sample

Labels:


Gixen - Free Auction Sniper