Below is code for .aspx file
<%@ 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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList runat="server" ID="DropDownList1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem>--SELECT--</asp:ListItem>
<asp:ListItem>Ford</asp:ListItem>
<asp:ListItem>Maruti</asp:ListItem>
<asp:ListItem>BMW</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Visible="false"></asp:Label>
</div>
</form>
</body>
</html>
Now put following in .cs file in "DropDownList1_SelectedIndexChanged" Event
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex > 0)
{
Label1.Text = DropDownList1.SelectedItem.Text;
Label1.Visible = true;
}
else
Label1.Visible = false;
}
}
Hope it will help u... if it helped then dnt forget to vote :)
cheers...