Posts

Showing posts from July, 2009

Send Email using Gmail SMTP server - ASP.NET

Send Email using Gmail SMTP server-ASP.NET What is an SMTP server? (pronounced as separate letters) Short for S imple M ail T ransfer P rotocol, a protocol for sending e-mail messages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail client using either POP or IMAP. In addition, SMTP is generally used to send messages from a mail client to a mail server. This is why you need to specify both the POP or IMAP server and the SMTP server when you configure your e-mail application. Let's see one example in ASP.NET 2.0 (Web Application) In WebMailSend.aspx.cs file You have to import this namespace for MailMessage. using System.Net.Mail; protected void btnSend_Click( object sender, EventArgs e) { try { MailMessage mail = new MailMessage(); mail.IsBodyHtml = true ; mail.To.Add(txtEmail.Text); mail.Subject = txtSubject.Text; mail....

Applying Dynamic Themes to WebPage

Applying Dynamic Themes to Web Page (.aspx) in ASP.NET Themes and Skins. The themes and skins features in ASP.NET 2.0 allow for easy customization of your site's look-and-feel. You can define style information in a common location called a "theme", and apply that style information globally to pages or controls in your site. Like Master Pages, this improves the maintainability of your site and avoid unnecessary duplication of code for shared styles. protected void Page_PreInit( object sender, EventArgs e) { Page.Theme = Session[ "Theme" ] as string ?? "Theme1" ; } protected void Page_Load( object sender, EventArgs e) { } protected void Button1_Click( object sender, EventArgs e) { if (Session[ "Theme" ] != null ) { if (Session[ "Theme" ].ToString() == "Theme1" ) Session[ "Theme" ] = "Theme2" ; else Session[ "Theme" ] = "Theme1...

Paged Data Source - Custom Paging

PagedDataSource , is a class that encapsulates the paging related properties for data-bound controls such as DataGrid, GridView, DataList, DetailsView and FormView that allow it to perform paging. And this article is going to combine both DataList control and PagedDataSource class to explain dynamic or custom paging methods for Asp.Net developers. protected void Page_Load( object sender, EventArgs e) { try { if (!IsPostBack) { LoadPhoto(); } } catch (Exception Exc) { HandleException = Exc; } } // LoadPhoto Function private void LoadPhoto() { PagedDataSource objPhotoPage = new PagedDataSource(); objPhotoPage.AllowPaging = true ; SOBLImageGallery _SOBLImageGallery = new SOBLImageGallery(); DataSet dsImageGallery = _SOBLImageGallery.Select6Records( new SOENTImageGallery()); if (dsImageGallery != null && dsImageGallery.Tables.Count > 0 && dsImageGallery.Tables[0]....

Abstract Class and An Interface

Abstract Class : The class which cannot be instantiated is known as an Abstract Class . So an object of it cannot be created. Hence it must be inherited. Can't be instantiated. Must be inherited. It may have Concrete Methods & Abstract Methods. An Abstract Class can have only Abstract Method. An Abstract Method must be overridden.     public abstract class AbstractA     {         public abstract string AbstractProperty { get ; set ; }         public abstract void AbstractFunction1();         public virtual void AbstractFunction2()         {             Console .WriteLine( "AbstractA : AbstractFunction2()" );         }         public void AbstractFunct...