.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to: Verify That Strings Are in Valid E-Mail Format

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :.NET Framework
This is HALF answered in the MSDN library with an example function called IsValidEmail. Does anyone else think maybe it's time the example function (which developers are likely to copy-paste) was changed to closer represented what an email address can actually be? Sure, it matches joe.blogs@example.com, or joe-blogs@example.com... But how about joe.blogs+work@example.com, or joe.blogs+support@example.com, or e=mc^2@example.com, or many other valid email addresses? The page http://msdn.microsoft.com/en-us/library/01escwtf.aspx has been updated for each new release of VisualStudio/.NET, but even the VS 2010/.NET4.0 one isn't much better!

View Complete Post

More Related Resource Links

Can we edit default mail format?



I have created a Sharepoint Designerworkflow, which gets initiated when a document is uploaded in document library.

I want to know that can we change the content of default mail.




Unable to load the package as XML because of package does not have a valid XML format. A specific XM


When I execute a DTSX (which was developed in BIDS 2005) in through

command prompt (on a server which only has SQL Server 2005 and SSIS 2005) using dtexec.exe against /File paramger, it was working perfectly fine.

However, I get the following error message after executing on a server which has SQL Server 2005 and SSIS 2005 & 2008.  Is it possible to execute a DTSX, which was developed in BIDS 2005, on a server that has both SSIS 2005 & 2008?  Please advise.  I often get the following error message in such case.  Thanks!


    "c:\Program Files\Microsoft SQL Server\90\DTS\Binn\dtexec" /FILE \\server123\DATA\AMP.dtsx /DECRYPT PassWordd > \\server123\DATA\output.txt

Error MSG:

     Microsoft (R) SQL Server Execute Package Utility
Version 9.00.4035.00 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started:  8:40:30 PM
Error: 2010-09-26 20:40:30.84
   Code: 0xC0011007
   Source: {0C157B60-C291-43ED-84A9-23F0DC7D5862}
   Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.
End Error
Error: 2010-09-26 20:40:30.84

Error: The file you imported is not valid. Verify that the file is a Web Part description file (*.we


Can anyone help me out?

i am getting the following error when i try to add the summary link web part by programmatically.

"The file you imported is not valid. Verify that the file is a Web Part description file (*.webpart or *.dwp)
 and that it contains well-formed XML "

My SummaryLink.webpart xml file is.

<?xml version="1.0" encoding="utf-8"?>
  <webPart xmlns="
      <type name="Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart, Microsoft.SharePoint.Publishing,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
        <property name="Title" type="string">Summary Link Web Part</property>
        <property name="Description" type="string">Use to display links on your web page that can be grouped and styled and can be organized by dragging and dropping</property>

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Mail Merge




I am after creating a mail merge documents from datasource and .dot template file on server side. Can you give me an idea how i will achive this?


Thanks in advance.



Syed Hussain



Export Dataset to excel sheet in a required format?



I know how to export a grid view to excel.

But here i have a Dataset which consists of data like below and also it need to display in a required format like below.

pno psubno pstate pdetailid pdetails

 12    1          CA         1           cbsdjcbdjc     

12     1          CA          2        cndcnjdcjcj

12     2           VA         4          xcndwkfcgygry

13     1            AL        1           ncdcnjdcndj

My excel sheet  should like this.

pid       pstate     

 12/1      CA             &nb

ReportViewer :: Failed to enable constraints. But my statement is valid!!

  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    Path not valid.



    im trying to save a file, filename as current date and time.it will give an error.

    any ideas.

    here is my code

    string datetime=DateTime.Now.ToString();

    if (GridviewtoCSV("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".csv", transactiongrid) && GridviewtoPDF("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".pdf", transactiongrid))

    Email Help (System.Net.Mail)


    Hi I have a annoying problem. 
    I have created a page which takes users details for a quote.

    I have then created the form to be emailed to both the user and myself. (Which works fine ATM)

    However I would also like to be able to attach a file containing terms and conditions to the email.

    I have tried doing this using 

    EmailMsg.Attachments.Add(new Attachment("C:\\attachme.txt"));

    But everytime that line of code is hit it fails and is caught by my try catch.

    Take that line out and the email sends fine, put it in and it breaks the whole page.

    Am I missing something really obvious?

    Windows With C++: X64 Debugging With Pseudo Variables And Format Specifiers


    This month we explain how pseudo variables and format specifiers provide a wealth of information for use in debugging.

    Kenny Kerr

    MSDN Magazine December 2008

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend