Code From Mail Transfer

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Code From Mail Transfer as PDF for free.

More details

  • Words: 1,484
  • Pages: 13
1. Mail Transfer 2. Change password 3. Validation strings 4. Countries dropdown list 5. Years dropdown list 6. State dropdown list: 7. For check boxes in mail transfer: 8. TO FIX THE LENGTH OF THE IMAGE: 9. Asp DetailView 10.child control from parent control

----------------------------------------------------------------------ClientScript.RegisterStartupScript(this.GetType(), "asd", "alert('Please Log Out from Whole_Sale')", true);  not to see every time the page is opened

Page.RegisterStartupScript("asd", "<script>alert('inserted successfully')");  to see every time the page is opened

Mail Transfer


MailMessage mm = new MailMessage(); mm.From = txtemail.Text; mm.To = "[email protected]"; mm.Cc = "[email protected]"; mm.Bcc="[email protected]"; mm.BodyFormat = MailFormat.Html; mm.Priority = MailPriority.High; mm.Subject = "Contact Us"; mm.Body = "

******* REQUEST FORM *****

" + "\n" +

"
" + "" + "First Name :" + "" + "" + "" + "" + txtfrist.Text + "" + "" + "
" + "
" + "" + "Last Name :" + "" + "" + "" + "" + txtlast.Text + "" + "" + "
" + "
" + "" + "Email Address :" + "" + "" + "" + "" + txtemail.Text + "" + "" + "
" + "
" + "" + "Work Phone Number :" + "" + "" + "" + "" + Txtphone.Text + "" + "" + "
" + "
" + "" + "Fax Number :" + "" + "" + "" + "" + Txtfax.Text + "" + "" + "
" + "
" + "" + "Organization Name :" + "" + "" + "" + "" + Txtorganise.Text + "" + "" + "
" + "
" + "" + "Street Address :" + "" + "" + "" + "" + txtstree.Text + "" + "" + "
" + "
" + "" + "Town / City:" + "" + "" + "" + "" + Txtcity.Text + "" + "" + "
" + "
" + "" + "State / Province:" + "" + "" + "" + "" + Txtstate.Text + "" + "" + "
" + "
" + "" + "Postal / Zip code" + "" + "" + "" + "" + Txtzip.Text + "" + "" + "
" + "
" + "" + "Country" + "" + "" + "" + "" + ddlcountry.SelectedValue + "" + "" + "
" + "
" + "" + "Subject" + "" + "" + "" + "" + txtsubject.Text + "" + "" + "
" + "
" + "" + "Message" + "" + "" + "" + "" + txtmsg.Text + "" + "" + "
"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mm); ClientScript.RegisterStartupScript(this.GetType(), "asd", "alert(\"Your Details Sent Successfully\")", true);

Change password For admin-protected void btnsubmit_Click(object sender, EventArgs e) { con.Open();

SqlCommand cmd = new SqlCommand("select * from admindetails where adminid='" + txtusername.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { SqlCommand cmd1 = new SqlCommand("update admindetails set adminpwd='" + txtnewpwd.Text + "' where adminid='" + txtusername.Text + "'", con); cmd1.ExecuteNonQuery(); Page.RegisterStartupScript("asd", "<script>alert('password updated successfully')"); } }

Validation strings [a-zA-Z ]* -- Allows only alphabets and whitespace. [a-zA-Z 0-9]* -- Allows only alphabets,whitespace and digits. [a-zA-Z 0-9-]* -- Allows only alphabets,whitespace, digits and hyphen. [\w ]* -- Allows are characters expect special characters.

Countries dropdown list Afghanistan Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua Argentina Armenia Aruba Ascension Island Australia Austria Azberbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize

Benin Bermuda Bhutan Bolivia Bosnia Botswana Brazil British Virgin Islands

Islands

Brunei Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Cape Verde Cayman Islands Central African

Rep.


of


Chad Chile China Christmas Island Cocos Islands Colombia Comoros Congo Congo, Dem. Rep. Cook Islands Costa Rica Croatia Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Rep. Ecuador Egypt Equatorial Guinea Eritrea Estonia Ethiopia Faeroe Islands Falkland Islands Fiji Islands Finland France French Guiana French Polynesia Gabon Gambia Georgia

Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guinea Guinea Bissau Guyana Haiti Honduras Hong Kong Hungary Iceland India Indonesia Iran Iraq Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho Liberia Libya Liechtenstein Lithuania Luxembourg Macau Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Islands Mexico Micronesia Moldova

Antilles


Monaco Mongolia Montserrat Morocco Mozambique Myanmar (Burma) Namibia Nauru Nepal Netherlands Netherlands New Caledonia New Zealand Nicaragua Niger Nigeria Niue Norfolk Island North Korea Norway Oman Pakistan Palau Palestine Panama Papua New Guinea Paraguay Peru Philippines Poland Portugal Puerto Rico Qatar Reunion Island Romania Russia Rwanda San Marino Sao Tome &

Principe


Saudi Arabia Senegal Seychelles Sierra Leone Singapore Slovakia Slovenia Solomon Islands Somalia South Africa South Korea Spain Sri Lanka St. Helena St. Kitts St. Lucia

Miquelon


St. Perre & St. Vincent Sudan Suriname Swaziland Sweden Switzerland Syria Taiwan Tajikistan Tanzania Thailand Togo Tonga Trinidad &

Tobago


Caicos


Tunisia Turkey Turkmenistan Turks & Tuvalu Uganda Ukraine UnitedArab

Emirates


United Kingdom Uruguay selected="selected">USA US Virgin Islands Uzbekistan Vanuatu Vatican City Venezuela Vietnam Western Samoa Yemen Yugoslavia Zambia Zimbabwe


Years dropdown list none 1953 1954 1955 1956 1957 1958 1959

1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007


State dropdown list: select State Alabama Alaska

Arizona Arkansas California Colorado Connecticut District of Columbia



Delaware Florida Georgia Hawaii Idaho Iowa Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada New Hampshire New Jersey New Mexico New York North Carolina North Dakota Ohio Oklahoma Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming ---Canadian Provinces--Alberta British Columbia Manitoba Newfoundland

New Brunswick Northwest Territories Nova Scotia Ontario Prince Edward Island Quebec Saskatchewan Yukon ---US Territories--- American Samoa Fed. Microneisa Guam Marshall Island N. Mariana Island Palau Island Puerto Rico Virgin Islands -------APO/FPO------ Military Americas Military Europe Military Pacific -------------------- Other or None


For check boxes in mail transfer: if(chkbox1.Checked==true) { s = "yes"; } else { s = "No"; }

TO FIX THE LENGTH OF THE IMAGE: -----------------------------------------------------------------------------------------------------------------------

cn.Open(); SqlCommand cmd = new SqlCommand("select images from product where productid='" + Session["imagename"] + "'", cn); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); string filename = dr["images"].ToString(); dr.Close();

cn.Close(); System.Drawing.Image i = System.Drawing.Image.FromFile(Server.MapPath("products/" + filename)); double h = i.Height; double w = i.Width; double height, width; height = Convert.ToDouble(h + 80.00); width = Convert.ToDouble(w + 50.00); if(height<=718 && width<=974) { StringBuilder sb = new StringBuilder(); sb.Append("<script>"); sb.Append("window.open('showimg.aspx', 'custompopup', 'width=" + width + ", height=" + height + ", location=center, toolbar=no,addressbar=no, scrollbars=no, resizable=yes');"); sb.Append(""); Page.RegisterStartupScript("test", sb.ToString());

------------------------------------------------------------------------------------------------------------------------cn.Open(); SqlCommand cmd = new SqlCommand("select images from product where productid='" + Session["imagename"] + "'", cn); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); string filename = dr["images"].ToString(); dr.Close(); cn.Close(); System.Drawing.Image i = System.Drawing.Image.FromFile(Server.MapPath("products/" + filename)); double h = i.Height; double w = i.Width; double height, width; height = Convert.ToDouble(h + 80.00); width = Convert.ToDouble(w + 50.00); if(height<=718 && width<=974) { StringBuilder sb = new StringBuilder(); sb.Append("<script>");

sb.Append("window.open('showimg.aspx', 'custompopup', 'width=" + width + ", height=" + height + ", location=center, toolbar=no,addressbar=no, scrollbars=no, resizable=yes');"); sb.Append(""); Page.RegisterStartupScript("test", sb.ToString());

Asp DetailView



10.child control from parent control To find out child control from parent control we use "$" acts as the delimiter. Syntax for find out child control from parent control is parentControlID$childControlID. Here, I give example to DefaultFocus attribute of the < form > element to set the focus to a TextBox nested within a FormView control. < form id="form1" runat="server" DefaultFocus="vwTest$txtName" > < div > < asp:FormView ID="vwTest" runat="server" > < ItemTemplate > Name: < asp:TextBox ID="txtName" runat="server" Text='' / > < /ItemTemplate > < /asp:FormView > < /div > < /form > Notice that the DefaultFocus attribute refers to the parent control first (the FormView) and then to the child control (the TextBox) using the vwTest$txtName syntax.

Related Documents

Code From Mail Transfer
November 2019 9
Mail From Anis
December 2019 13
Mail From Me Chivain M
October 2019 5
Mail
May 2020 32
Mail
November 2019 76