Wednesday 6 June 2012

ASP.NET Ajax Extension - Timer control

Paste Into ASPX Source
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="timer.aspx.cs" Inherits="timer" %>
 
<!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 id="Head1" runat="server">
<title>ASP.NET EXAMPLES | Ajax Extensions | Ajax Examples | Ajax Timer control </title>
</head>
<body style="font-family:Tahoma; font-size:14px;">
<form id="form1" runat="server">
<center>
<div style="border: 2px; font-size: 12px; border-color: Black; border-style: solid;
color: White; background-color: Red; font-weight: bold; font-family: Tahoma">
By : <a href="http://asp-examples.blogspot.com/" style="color: Yellow" target="_search">
asp-examples</a> (Click to get more Asp.net Examples)
<br />
Author : Akash Parmar<br />
Company Name : Soft-Tech Designs n Development<br />
We Design your Dreams - Develop your Life...
</div>
<div>
<%--Its required to place ScriptManager within the form tag whenever you use any Ajax Controls...--%>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<h4>
ASP.NET Ajax Timer control...</h4>
<h4>
Countdown Timer using Ajax Timer Control...
</h4>
</div>
<div style="border: 2px; height:100px;  border-color: Black; border-style: solid">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="10" Font-Size="50pt" 
Font-Bold="True" ForeColor="#FF3300"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server" Font-Size="30pt" 
Text="seconds remaining...."></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
</asp:Timer>
<br />
<asp:Label ID="Label3" runat="server" Font-Size="20pt" Font-Bold="True" 
ForeColor="#FF3300"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</center>
</form>
</body>
</html>

Paste Into ASPX.CS Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class timer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
 
}
protected void Timer1_Tick(object sender, EventArgs e)
{
if (Convert.ToInt32(Label1.Text) > 1)
{
Label1.Text = Convert.ToString(Convert.ToInt32(Label1.Text) - 1);
}
else
{
Timer1.Enabled = false;
Label3.Text = "Time Up..!";
Label1.Visible = false;
Label2.Visible = false;
}
}
}

Friday 1 June 2012

ASP.NET Ajax Extension - Update Panel Example with Trigger

Paste Into ASPX Source
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UpdatePanelwithTrigger.aspx.cs"
Inherits="Ajax_Extension_UpdatePanelwithTrigger" %>
 
<!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>ASP.NET EXAMPLES | Ajax Extensions | Ajax Examples | Update Panel Example with
Trigger </title>
</head>
<body style="font-family:Tahoma; font-size:14px;">
<form id="form1" runat="server">
<center>
<div style="border: 2px; font-size: 12px; border-color: Black; border-style: solid;
color: White; background-color: Red; font-weight: bold; font-family: Tahoma">
By : <a href="http://asp-examples.blogspot.com/" style="color: Yellow" target="_search">
asp-examples</a> (Click to get more Asp.net Examples)
<br />
Author : Akash Parmar<br />
Company Name : Soft-Tech Designs n Development<br />
We Design your Dreams - Develop your Life...
</div>
<div>
<%--Its required to place ScriptManager within the form tag whenever you use any Ajax Controls...--%>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<h4>
ASP.NET Ajax Extension Update Panel Example with Trigger 
using Dropdownlists...</h4>
<h4>
Displays List in Dropdownlist(Inside Panel) related selection from Dropdowntlist(Outside Panel)...
</h4>
</div>
<div style="border: 2px; height:150px;  border-color: Black; border-style: solid">
<h5>
Outside Update Panel</h5>
<asp:DropDownList ID="ddlfrom" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlfrom_SelectedIndexChanged">
<asp:ListItem>select</asp:ListItem>
<asp:ListItem>hardware</asp:ListItem>
<asp:ListItem>software</asp:ListItem>
</asp:DropDownList>
</div>
<br />
<div style="border: 2px; height:150px; border-color: Black; border-style: solid">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<h5>
Inside Update Panel</h5>
<asp:DropDownList ID="ddlto" runat="server" Visible="False">
</asp:DropDownList>
</ContentTemplate>
<%--Declaring Triggers for Dropdownlist(ddlfrom) SelectedIndexChanged event...--%>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlfrom" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
<br />
</div>
</center>
</form>
</body>
</html>
Paste Into ASPX.CS Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Ajax_Extension_UpdatePanelwithTrigger : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
 
}
protected void ddlfrom_SelectedIndexChanged(object sender, EventArgs e)
{
string[] hardware = new string[] { "Processor", "Motherboard", "Harddisk" };
string[] software = new string[] { "Windows XP", "Vista", "Linux" };
 
if (ddlfrom.SelectedItem.Text == "select")
{
ddlto.Visible = false;
}
else if (ddlfrom.SelectedItem.Text == "hardware")
{
ddlto.Visible = true;
ddlto.DataSource = hardware;
ddlto.DataBind();
}
else
{
ddlto.Visible = true;
ddlto.DataSource = software;
ddlto.DataBind();
}
}
}

Wednesday 30 May 2012

ASP.NET Ajax Extension Update Panel Example

Paste Into ASPX Source
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UpdatePanel.aspx.cs" Inherits="Ajax_Extension_UpdatePanel" %>

<!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>ASP.NET EXAMPLES | Ajax Extensions | Ajax Examples | Update Panel Example
    </title>
</head>
<body style="font-family:Tahoma; font-size:14px;">
    <form id="form1" runat="server">
    <center>
        <div style="border: 2px; font-size:12px; border-color: Black; border-style: solid; color: White;
            background-color: Red; font-weight: bold; font-family: Tahoma">
            By : <a href="http://asp-examples.blogspot.com/" style="color:Yellow" target="_search">asp-examples</a>
            (Click to get more Asp.net Examples)
            <br />
            Author : Akash Parmar<br />
            Company Name : Soft-Tech Designs n Development<br />
            We Design your Dreams - Develop your Life...
        </div>
    </center>
    <div>
        <%--Its required to place ScriptManager within the form tag whenever you use any Ajax Controls...--%>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <h4>
                ASP.NET Ajax Extension Update Panel Example - Button Click Event -
            </h4>
            <h4>
                Gets the text from TextBox and Prints in Label1(Inside Update Panel) but prevents
                changes in Label2(out side update panel)...
            </h4>
        </div>
        <center>
            <div style="border: 2px; border-color: Black; border-style: solid">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <h5>
                            Inside Update Panel</h5>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:Button ID="Button1" runat="server" Text="Show" OnClick="Button1_Click" /><br />
                        <asp:Label ID="Label1" runat="server" Text="Label1"></asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <br />
            <div style="border: 2px; border-color: Black; border-style: solid">
                <h5>
                    Outside Update Panel</h5>
                <asp:Label ID="Label2" runat="server" Text="Label2"></asp:Label>
            </div>
        </center>
    </div>
    </form>
</body>
</html>
Paste Into ASPX.CS Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = TextBox1.Text;
        Label2.Text = TextBox1.Text;
    }
}

Monday 21 May 2012

ASP.NET Hyperlink SERVER CONTROL | Navigate URL | Redirects to New URL

Paste Into ASPX Source

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="hyperlink.aspx.cs" Inherits="hyperlink" %>
 
<!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 id="Head1" runat="server">
<title>ASP.NET EXAMPLES | Hyperlink SERVER CONTROL | Navigate URL | Redirects to New URL</title>
</head>
<body>
<form id="form1" runat="server">
<center>
<div style="border: 2px; font-size:12px; border-color: Black; border-style: solid; color: White;
background-color: Red; font-weight: bold; font-family: Tahoma"
>
By : <a href="http://asp-examples.blogspot.com/" style="color:Yellow" target="_search">asp-examples</a>
(Click to get more Asp.net Examples)
<br />
Author : Akash Parmar<br />
Company Name : Soft-Tech Designs n Development<br />
We Design your Dreams - Develop your Life...
</div>
<div>
<h4>
ASP.NET Hyperlink Control Example - Navigate URL - Redirects a client to specified URL
</h4>
</div>
<center>
<div>
<br /><br />
1) Redirects in new Tab or Window :
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="http://google.co.in" Target="_blank">Click Here To Go To Google - Target - Blank >></asp:HyperLink>
<br /><br />
2) Redirects in Same Tab or Window :
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="http://google.co.in" Target="_parent">Click Here To Go To Google - Target - Parent >></asp:HyperLink>
</div>
</center>
</form>
</body>
</html>

Sunday 20 May 2012

ASP.NET Button Server Control - Click Event

Paste Into ASPX Source
<%@ 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>ASP.NET EXAMPLES | BUTTON SERVER CONTROL | BUTTON CLICK EVENT</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h4>
ASP.NET Button Control Example - Click Event - Gets the text from TextBox and Prints
in Label on Button Click...
</h4>
</div>
<center>
<div>
Enter your name :
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="show" />
<br />
<asp:Label ID="lblname" runat="server" Font-Bold="True"></asp:Label>
</div>
</center>
</form>
</body>
</html>

Paste Into ASPX.CS Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class _Default : System.Web.UI.Page 
{
protected void Page_Load(object sender, EventArgs e)
{
 
}
protected void Button1_Click(object sender, EventArgs e)
{
lblname.Text = txtname.Text;
}
}

Thursday 17 May 2012

Simple TextBox Example - Text Changed Event

Paste Into ASPX Source

<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<center>
<div style="border: 2px; font-size:12px; border-color: Black; border-style: solid; color: White;
background-color: Red; font-weight: bold; font-family: Tahoma"
>
By : <a href="http://asp-examples.blogspot.com/" style="color:Yellow" target="_search">asp-examples</a>
(Click to get more Asp.net Examples)
<br />
Author : Akash Parmar<br />
Company Name : Soft-Tech Designs n Development<br />
We Design your Dreams - Develop your Life...
</div>
<div>
<h4>
Simple Textbox Example - Textchanged Event - Gets the text from TextBox and Prints in Label...
</h4>
</div>
<center>
<div>
Enter your name :
<asp:TextBox ID="txtname" runat="server" AutoPostBack="True" OnTextChanged="txtname_TextChanged"></asp:TextBox>
<br />
<br />
<asp:Label ID="lblname" runat="server" Font-Bold="True"></asp:Label>
</div>
</center>
</form>
</body>
</html>

Paste Into ASPX.CS Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class _Default : System.Web.UI.Page 
{
protected void Page_Load(object sender, EventArgs e)
{
 
}
protected void txtname_TextChanged(object sender, EventArgs e)
{
lblname.Text = "Hello " + txtname.Text;
}
}

Thursday 10 May 2012

Welcome To ASP-Examples

This Blog is Under Construction

We are coming very soon for you

 
Ranking Website Directory | seo tool | Manoli | ASPDOTNETGUIDE