The input element with type attribute value equal to "email" represents a control to accepts values in an e-mail address format. It doesn't check or validates empty or empty value.

Supported in:
Works in Chrome
Not in Firefox, IE

  
  
  
  


Sample Result:









Code Reference:
Najeeb W. Najeeb


To exit the foreach earlier than it suppose to be we have to use the break statement. By using the break statement, it terminates the closest enclosing loop or switch statement.

Please see the example below. The statements below is an example of a search algorithm where the loop terminates as soon as it found the search item on the list.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TestSolution
{
    public partial class ForeachBreak : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //creates list of string data
            List lst = new List();
            lst.Add("anna");
            lst.Add("jun");
            lst.Add("sam");
            lst.Add("leila");

            //set search item to search to the list
            string searchItem = "jun";
            
            //flag to know that the item been seached exist or not
            bool isFound = false;

            foreach (string s in lst)
            {
                if (s.Equals(searchItem))
                {
                    isFound = true;
                    break; 
                }
            }

            //show the result
            Response.Write(isFound);

        }
    }
}

To change the value or content of the div tag, use the .html() property.

Syntax:
[DivID].html([value]);

Where [DivID] is the id of the div and [value] is the value or content you want to put on the div. The [value] accepts html tag.

In my example below, i use drop-down menu to dynamically change the value of the div tag.
     
    
    
    What is your favorite color?
    
        
        Blue
        Red
        Violet
        White
    
    

    

    Your favorite color is:
    
[blank]
Result:










L.
Sending mail in C# is very straight forward. Follow the following steps:

1. Set-up SMTP E-mail Settings. You can either set-up under ASP.NET Configuration or manually set-up under web.config.

    Option 1: ASP.NET Configuration
          a. Under Menu, go to "Project" and click on "ASP.NET Configuration". Click the "Application" tab, and then click the "Configuration SMTP e-mail settings".




          b. Set-up email settings. Add SMTP Settings depending on your mail server. the example below uses google smtp server for example purpose only.







    Option 2: Manual Mail setting at web.config
          a. Add the following tag under inside configuration tag of the web.config file.
  
    
      
        
      
    
  
2. Add code statement. Add the following code statement on the code behind. The statement below sends message to email.

using System.Net.Mail;
using System.IO;

        protected void Page_Load(object sender, EventArgs e)
        {
            SendEmail();
        }

        private void SendEmail()
        { 
            MailMessage message = new MailMessage();
            message.From = new MailAddress("usernameFrom@gmail.com", "Name");
            message.To.Add("usernameTo@gmail.com");
            message.Subject = "Test Subject";

            //if you want the message to show as HTML format
            message.IsBodyHtml = true;

            message.Body = "Your email message here.";

            var client = new SmtpClient("smtp.gmail.com", 587);
            //make sure its the same with SMTP Settings
            client.Credentials = new System.Net.NetworkCredential("username@gmail.com", "MyPasswordHere");
            client.Send(message);
        }

3. Test and check sent email.


L.
Regular Expression:
[0-9]*

The regular expression above validates numbers at any length.

Used in ASP.NET Regular Expression Validator:
*
                    Total Amount Paid
                


L.