Objective:-Write a Programme to use the combination of Two DropDownList With AJAX Extensions(ScriptManager & Timer) And Wait gif Animation Image.
STEPS :-
STEP:- 1 CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.
STEP:- 2 ADD TOOLS
Drag & Drop these tools which you can see in the Left side of toolbox.
I think this image will help you that which tool you have to Drag & Drop from Toolbox.
STEP:- 3 To Create a folder and keep a image in the folder.
Go to Solution Explorer-> Right clock on WebApplication-> Add-> Click on New Folder
Rename and paste Any Wait gif Animation Image from given link.
http://softbehave.blogspot.in/p/collection-of-loading-image.html
********HTML Code***************
- <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
- CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
- <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
- </asp:Content>
- <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
- <h2>
- Welcome to ASP.NET!
- </h2>
- <div style="height: 300px">
- <br/>
-
- <asp:Image ID="Image1" runat="server" ImageUrl="~/Image/SmallLoader.gif" />
- <br />
- Enter Catogary:
- <asp:DropDownList ID="DropDownList1" runat="server">
- <asp:ListItem>Boy</asp:ListItem>
- <asp:ListItem>Girl</asp:ListItem>
- <asp:ListItem>Animal</asp:ListItem>
- </asp:DropDownList>
-
- <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Small"
- ForeColor="Blue" Text="Please Wait . . ."></asp:Label>
- <br />
-
- <br />
- Sub Catogary:
- <asp:DropDownList ID="DropDownList2" runat="server">
- </asp:DropDownList>
- <br />
- <br />
-
- <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Show" />
-
- <br />
-
- <br />
-
- <br />
- <asp:ScriptManager ID="ScriptManager1" runat="server">
- </asp:ScriptManager>
-
- <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="6000"
- ontick="Timer1_Tick">
- </asp:Timer>
- </div>
- </asp:Content>
********C# Code***************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplication1
- {
- public partial class _Default : System.Web.UI.Page
- {
- int sec = 0;
- protected void Page_Load(object sender, EventArgs e)
- {
- Image1.Visible = false;
- Label1.Visible = false;
- }
- protected void Timer1_Tick(object sender, EventArgs e)
- {
- sec++;
- if (sec == 10)
- {
- }
- Image1.Visible = false;
- Timer1.Enabled = false;
- Label1.Visible = false;
- if (DropDownList1.Text == "Boy")
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Ravi");
- DropDownList2.Items.Add("Manoj");
- DropDownList2.Items.Add("Sunil");
- DropDownList2.Items.Add("Rajesh");
- }
- else if (DropDownList1.Text == "Girl")
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Soni");
- DropDownList2.Items.Add("Anjali");
- DropDownList2.Items.Add("Neha");
- DropDownList2.Items.Add("Rupa");
- }
- else
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Cow");
- DropDownList2.Items.Add("OX");
- DropDownList2.Items.Add("Fox");
- DropDownList2.Items.Add("Cat");
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Timer1.Enabled = true;
- Image1.Visible = true;
- Label1.Visible=true;
- }
- }
- }


No comments:
Post a Comment