Try this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="daniweb.web.WebForm1" %>
<!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">
<div>
<asp:dropdownlist ID="Dropdownlist1" runat="server">
<asp:ListItem Value="Value1">Text1</asp:ListItem>
<asp:ListItem Value="Value2">Text2</asp:ListItem>
</asp:dropdownlist>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html> using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace daniweb.web
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string script =
string.Format("javascript:document.getElementById('{0}').innerText = {1}.options[{1}.selectedIndex].value;",
Label1.ClientID,
Dropdownlist1.ClientID);
Dropdownlist1.Attributes.Add("onChange", script);
}
}
}