Posts

Showing posts from August, 2011

Send Mail by Gmail

การเขียนโปรแกรมส่งเมลล์ให้มีความน่าเชื่อถือมากยิ่งขึ้น กรณีที่ไม่มี SMTP ใช้เป็นของตัวเองก็สามารถใช้งาน SMTP ของ GMAIL ไปใช้งานได้ Imports System.Net.Mail Imports System.Net.Mail.MailMessage Imports System.Net.NetworkCredential Partial Class _Default     Inherits System.Web.UI.Page         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load         Dim mail As New MailMessage()         Dim msgBody As String = ""         Dim smtp As New SmtpClient         mail.From = New MailAddress("prompratan@gmail.com", "Display-Name")         mail.To.Add("mymail@aaa.com")         mail.Subject = "Subject"         mail.Body = "msgBody"         mail.IsBodyHtml = True ' This is to enable HTML in your email body         smtp.Host = "smtp.gmail.com"         smtp.Port = 25         smtp.EnableSsl = True         smtp.Credentials = New System.Net.NetworkCredential("use

GridView : OnMouseOver, OnMouseOut

aspx.vb -- GridView_RowDataBound Protected Sub gv_Series_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_Series.RowDataBound   If (e.Row.RowType = DataControlRowType.DataRow) Then     e.Row.Attributes.Add("OnMouseOver", "javascript:setMouseOverColor(this);")     e.Row.Attributes.Add("OnMouseOut", "javascript:setMouseOutColor(this);")   End If End Sub aspx -- JavaScript var oldgridSelectedColor; function setMouseOverColor(element) {   oldgridSelectedColor = element.style.backgroundColor;   element.style.backgroundColor = 'yellow'; } function setMouseOutColor(element) {   element.style.backgroundColor = oldgridSelectedColor; }