<asp:DropDownList id='DropDownList1' runat='server' AutoPostBack='True'>
<asp:ListItem Value='Red'>Red</asp:ListItem>
<asp:ListItem Value='Blue'>Blue</asp:ListItem>
<asp:ListItem Value='Green'>Green</asp:ListItem>
</asp:DropDownList>
VB.NET
Page.RegisterClientScriptBlock('BodyStyle', '<style type=’text/css’>body{background-color: ' + DropDownList1.SelectedItem.Value + ';}</style>')
C#
Page.RegisterClientScriptBlock('BodyStyle', '<style type=’text/css’>body{background-color: ' + DropDownList1.SelectedItem.Value + ';}</style>');
Share with