Wednesday 26 February 2014

Send Email to all user's email Id in the Database in Asp.net


Description:- Hello Friends Today we will learn that how to send email to all the user's email id in the database on Button click event.First of all we will create a button on design page.On the onclick event give a name to the event whatever you want.Second thing you have to make a Table in the database that is containing Column for email in which the email id for all the user are stored.i will also provide you snapshots for creating your Table in the database.the snapshot for database are given below.
Database Table:- Design Table according to your Data that you want to store in the database.
After Creating add the data to the table.Now the code for Design page is below.
Demo:-


Design Code:-

Code Behind:-
 protected void SendMail_Click(object sender, EventArgs e)
{
    cmd3 = new SqlCommand("select email from tbluser", con);
        string email;
        con.Open();
       SqlDataReader dr=cmd3.ExecuteReader();
       while(dr.Read())
       { 
           email=dr[0].ToString();
           MailMessage myMsg = new MailMessage();
           myMsg.From = new MailAddress("*****@gmail.com");
           myMsg.To.Add(email);
           myMsg.Subject = "This is Reminder Mail to you";
           myMsg.IsBodyHtml = true;
           string currentyear = DateTime.Now.Year.ToString();


           myMsg.Body = "Dear Pay your Membership Fee.If Already Paid Ignore this mail";



           myMsg.CC.Add("*********@gmail.com");
           // your remote SMTP server IP.
           SmtpClient smtp = new SmtpClient();
           smtp.Host = "smtp.gmail.com";
           smtp.Port = 587;
           smtp.Credentials = new System.Net.NetworkCredential("*******@gmail.com", "Password");
           smtp.EnableSsl = true;
           smtp.Send(myMsg);

           lblmail.Text = "Mail Sent";
       }
}

Wednesday 1 January 2014

Working with label Control and its Properties in Asp.net

 

Description:- A Label is used to display the text on the Page.Using TextBox and Button we can display the text from textbox into Label control.The properties of labels are as follows
  • AccessKey,Attributes,BackColor ,BorderColor,BorderStyle,BorderWidth,CssClass,Enabled,Font,EnableTheming,ForeColor,Height, IsEnabled,SkinID,Style,TabIndex,ToolTip,Width,EnableViewState,Visible,
  • Now in this Example we need one Text Box,one Button and one Label to display the Text.
Demo:- 
Design Code:-  


     
 Code Behind:-
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void BtnlblText(object sender, EventArgs e)
    {
        lbltext.Text = TxTLabel.Text;
    }

}

Friday 26 July 2013

Change Menu Hover Styling in Asp.net

Description:- In Previous articles We have learned Range Validator Email and Phone Number , Web Url Address Validation. Now in this Article We Describe How to use Range Validator Between Two values.Now in this article we learn How to change Menu Style on hover.


Demo:- 


Coding:-  

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
   
        #mnuMyWeb
        {
            background:darkgreen;
            border:groove 3px darkblue;
        }
       
        #mnuMyWeb a
        {
            border-right:solid 1px lightyellow;
            color:lightyellow;
            padding:5px 8px 5px 8px;
            display:inline-block;
         }
       
        #mnuMyWeb a:hover
        {
            background:lightyellow;
            color:darkgreen;
            }
       
        #mnuMyWeb a.active
        {
            background:darkblue;
            color:Red;
            }
       
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Menu ID="mnuMyWeb" Orientation="Horizontal" runat="server">
            <Items>
                <asp:MenuItem Text="Home" Selected="true" NavigateUrl="~/Home.aspx" />
                <asp:MenuItem Text="About Us" NavigateUrl="~/AboutUs.aspx" />
                <asp:MenuItem Text="Services" NavigateUrl="#" />
                <asp:MenuItem Text="Contacts" NavigateUrl="#" />
            </Items>
        </asp:Menu>
    </div>
    </form>
</body>
</html>

Thursday 20 June 2013

Range Validator on Text Change Error Message in Asp.net Validation

Description:- In Asp.net Validation Now we started to cover All Validations used in Asp.net.In my previous Articles We done Email and Phone Number , Web Url Address Validation. Now in this Article We Describe How to use Range Validator Between Two values.So My friends here is the Demo How The Code Works..


Demo:-



Coding:- 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="lblNum" runat="server">Enter age Between 18 to 28</asp:Label>
   
    &nbsp;&nbsp;&nbsp;
   
    <asp:TextBox ID="txtage" runat="server" ></asp:TextBox>
    <asp:RangeValidator runat="server" ID="rgvtxtage" ErrorMessage="Please Enter Age Between 18 to 28" MinimumValue="18" MaximumValue="28" Type="Integer" ControlToValidate="txtage"></asp:RangeValidator>
   
   
    </div>
    </form>
</body>
</html>

Friday 14 June 2013

Allow only Numbers in Textbox Using JavaScript.

 Description:- Dear Friends in My some previous article We Learned about Only Alphabets allow in textbox in javaScript, JQuery Javascript Some Tutorial Like as easeOut Effect in JQueryHow To make Slider in JavaScript,Wait for Downloading Counter,Highlight Searched Text in Gridview,Dropdown list atteched with Selection of another DropDown and many more Article on Asp.net,Css,JavaScript,Html,Jquery.Now In this Article We Learn That How to allow only Numbers in textbox Using JavaScript .

Demo:-
                           
                           

Coding:-

<html>
<head>
    <title>allwon only numbers in textbox using JavaScript</title>
    <script language="Javascript" type="text/javascript">

        function NumberOnly(e, t) {
            try {
                if (window.event) {
                    var charCode = window.event.keyCode;
                }
                else if (e) {
                    var charCode = e.which;
                }
                else { return true; }
                if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                    return false;
                }
                return true;
            }
            catch (err) {
                alert(err.Description);
            }
        }

    </script>
</head>
<body>
    <table align="center">
        <tr>
            <td>
                <input type="text" onkeypress="return NumberOnly(event,this);" />
            </td>
        </tr>
    </table>
</body>
</html>

Thursday 13 June 2013

Only Letters allowed in text Box Using JavaScript.

Description:- Dear Friends in My some previous article We Learned about JQuery Javascript Some Tutorial Like as easeOut Effect in JQueryHow To make Slider in JavaScript,Wait for Downloading Counter,Highlight Searched Text in Gridview,Dropdown list atteched with Selection of another DropDown and many more Article on Asp.net,Css,JavaScript,Html,Jquery.Now In this Article We Learn That How to allowed only Alphabets in textbox Using JavaScript .


Demo:-



Coding:-

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Aspdotnet Studio</title>
    <script type="text/javascript">
function OnlyAlphabet(){
               if (!FrmText.Letters.value.match(/^[a-zA-Z]+$/) && FrmText.Letters.value !="")
               {
                    FrmText.Letters.value="";
                    FrmText.Letters.focus();
                    alert("Only Alphabets Allowed");
               }
}    
</script>
   
   
   
   
</head>
<body>
   
<table align=center>
<tr><td><form name="FrmText">
Enter Text: <input type="text" name="Letters" onkeyup="OnlyAlphabet()">
</form><br;>
</td></tr>
<script type="text/javascript">document.onload = ctck();</script>
</td></tr>
</table>
</body>
</html>


Show Hide Image Programmatically in Asp.net.

Description:- Dear Friends in My some previous article We Learned about JQuery Javascript Some Tutorial Like as easeOut Effect in JQueryHow To make Slider in JavaScript,Wait for Downloading Counter,Highlight Searched Text in Gridview,Dropdown list atteched with Selection of another DropDown and many more Article on Asp.net,Css,JavaScript,Html,Jquery.Now In this Article We Learn That how to Show hide Image or any other control programmatically in Asp.net.


Demo:-



Coding:-

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Image1.Visible = false;
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        Image1.Visible = true;
    }
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to show, hide, visible TextBox programmatically</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style=" background-color:orange; color :white; width: 321px; height: 27px;">Show Hide controls in Asp.net </h2>
         
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         
        <asp:Image ID="Image1" runat="server" ImageUrl="~/1.jpg" Height="281px"
            Width="274px" />
        <br /><br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button  
             ID="Button1"  
             runat="server" BackColor="OrangeRed"  
             ForeColor="White"
             Text="Hide Love"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button  
             ID="Button2"  
             runat="server" BackColor="OrangeRed"  
             Font-Bold="true"
             ForeColor="White"
             Text="Show Love"
             OnClick="Button2_Click"
             />
    </div>
    </form>
</body>
</html>  

Wednesday 12 June 2013

Bouncing Navigation Menu Bar easeOut Effect using Jquery in Asp.net.

Description:- Dear Friends in my previous Article of Jquery We learn How to Zoom Out & Zoom In Using JQuery in Asp.net and JQuery Show Hide Option Theme Change & Using Buttons,Now in this article we learn How to make Bouncing Navigation Menu Bar easeOut Effect using Jquery in Asp.net.


Demo:-


Coding:-


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>jQuery Menu with Bounce Effect</title><script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script><script type="text/javascript" src="http://dev.css-zibaldone.com/js/jquery/plugins/jquery.easing.js"></script><script type="text/javascript">$(function () {$('li', '#navigation').each(function () {var $jli = $(this);var $a = $('a', $jli);$a.hover(function () {$a.stop(true, true).animate({height: '3em',lineHeight: '3em',bottom: '1em'}, 'slow', 'easeOutBounce');}, function () {$a.stop(true, true).animate({height: '2em',lineHeight: '2em',bottom: 0}, 'slow', 'easeOutBounce');});});});</script><style type="text/css">#navigation {height: 4em;margin: 0;padding: 0 1em;list-style: none;border-bottom: 2px solid #0270BF;}#navigation li {height: 100%;float: left;margin-right: 0.5em;}#navigation a {float: left;height: 2em;padding: 0 1em;background: #0270BF;color: #fff;line-height: 2;text-transform: uppercase;font-weight: bold;text-decoration: none;margin: 2em 0 0 0;letter-spacing: 0.1em;position: relative;}#navigation a:hover {background: #F86000;}</style></head><body><div><ul id="navigation"><li><a href="#">Asp.Net</a></li><li><a href="#">Jquery</a></li><li><a href="#">CSS</a></li></ul></div></body></html>


Tuesday 11 June 2013

How to make A Calculator in JavaScript

Description:- In My Previous Article I Explained About How To make Slider in JavaScript,Wait for Downloading Counter,Highlight Searched Text in Gridview,Dropdown list atteched with Selection of another DropDown and many more Article on Asp.net,Css,JavaScript,Html,Jquery.Now in this article i will Explain How to create a Calculater  using JavaScript,


Demo:-



Coding:-

<html>
<head>
<title>On Page Javascript</title>
<script type="text/javascript" language="javascript">
function calc()
{
var v1 = document.getElementById("txtV1").value;
var v2 = document.getElementById("txtV2").value;
var op = document.getElementById("selOperator");
op = op.options[op.selectedIndex].value;
if(chkNumeric(v1)&&chkNumeric(v2))
{
var lbl = document.getElementById("lblAnswer");
if(op == '+')
lbl.innerHTML = parseFloat(v1) + parseFloat(v2);
else if(op == '-')
lbl.innerHTML = parseFloat(v1) - parseFloat(v2);
else if(op == '*')
lbl.innerHTML = parseFloat(v1) * parseFloat(v2);
else if(op == '/')
lbl.innerHTML = parseFloat(v1) / parseFloat(v2);
}
else
{
if(!chkNumeric(v1) && !chkNumeric(v2)) alert("Please enter Numeric Values in both Boxes.");
else if (!chkNumeric(v1)) alert("Please enter a Numeric Value in First Box.");
else if(!chkNumeric(v2)) alert("Please enter a Numeric Value in Second Box.");
}
}
function chkNumeric(v)
{
var isvalid = true;
var validletters = "0123456789.";
for(i=0;i<v.length;i++)
{
if(validletters.indexOf(v.charAt(i),0)<0)
{
isvalid = false;
break;
}
}
return isvalid;
}
</script>
</head>
<body>
<input type="text" id="txtV1"/>&nbsp;
<select id="selOperator">
<option selected="selected" value="+">+</option>
<option value="-">-</option>
<option value="*">x</option>
<option value="/">/</option>
</select>&nbsp;
<input type="text" id="txtV2"/>&nbsp;
<input type="button" value="=" onclick="calc()"/>&nbsp;&nbsp;
<label id="lblAnswer"></label>
</body>
</html>

Sunday 9 June 2013

How to make slider in JavaScript with equal time Difference.

Demo:-
             



About:- In the previous Article We Learn how Wait time counter in JavaScript And Now in this Article We Learn How to make a simple slider using  JavaScript.You can increase or decrease the time to change the speed of Image in the code.Please just change the images and add your image to the coding.


Coding:-


<html>
<head>
<title>Slider</title>
<script type="text/javascript" language="javascript">
function startslider(imgindex)
{
var arrImages = new Array('1.jpg','2.jpg','3.jpg','4.jpg','5.jpg');
var arrAlts = new Array('Alt1','Alt2','Alt3','Alt4','Alt5');
var imge = document.getElementById("imgSlider");
imge.src = 'images/' + arrImages[imgindex];
imge.alt = arrAlts[imgindex];
if(imgindex == 4) imgindex = 0;
else imgindex++;
setTimeout('startslider(' + imgindex +')',1000); }
</script>
</head>
<body onload="startslider(0)">
<img src="" alt="" id="imgSlider" style="width:480px;height:220px;border:solid 2px black;"/>
</body>
</html>