Jan 9, 2008

How to check email works with no SMTP

There is a way to send e-mails with no SMTP server set up. Just configure your .NET application to drop e-mails into a specified folder instead of sending them via SMTP server



      <smtp deliveryMethod="SpecifiedPickupDirectory">

        <specifiedPickupDirectory pickupDirectoryLocation="c:\Rohit\" />




This will instruct SmtpClient class to generate mail message, save it as .eml file and drop it into c:\Test\ folder

kick it on DotNetKicks.com

Jan 8, 2008

Using CompareValidator for just Data Validation

A simple method to validate an integer, double, date, or currency values entered into a textbox on ASP.NET page

Normally the CompareValidator is used to check one value against another on ASP.NET page. However it also can be used to ensure user has entered data in a correct format. (Data Validation)

Here's how it works:

  • Set the ControlToValidate property to the ID of the TextBox.
  • Set the Operator property to DataTypeCheck.
  • Assign a ValidationDataType enumeration member to the Type property, which includes either one of the following : String, Integer, Double, Date, and Currency.

kick it on DotNetKicks.com

Jan 3, 2008

using FOR XMLPATH to concat multiple row values

The need is to concatenate multiple row values from a table
The following TSQL in SQL 2005 can assist in returning values

Following is the input table
ID Value
1 '-'
1 'C'
1 'B'
1 'A'
2 '='
2 'G'
2 'D'
Expected output :
ID Concat
1 '-CBA'
2 '=GD'

TSQL for this :
select Distinct ID, o.List
#t1 A
select Val as [text()] from #t1 B
where B.ID = A.ID
) o (List)

kick it on DotNetKicks.com