Hi i don't know why the following doesn't work. I simply have a list of items in an array which i have bound to a dropdownlist.
Problem is here: bgColor="<%response.write(MyColorText)%>"Code:<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <script runat="server"> Sub Page_Load() If NOT ispostback then Dim ColorArray(4) as String ColorArray(0) = "Blue" ColorArray(1) = "Red" ColorArray(2) = "Green" ColorArray(3) = "Yellow" ColorArray(4) = "Orange" MyDropDownList.DataSource = ColorArray MyDropDownList.DataBind() End if End Sub Sub ColorSelected(Source as Object, E as EventArgs) Dim MyColorText as String MyColorText = MyDropDownList.SelectedItem.text response.write (MyColorText) End Sub </script> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgColor="<%response.write(MyColorText)%>" > <form runat="server"> <asp:dropdownlist ID="MyDropDownList" runat="server"></asp:dropdownlist> <asp:button text="Hit Me" onCLick="ColorSelected" runat="server" /> </form> </font> </body> </html>




Reply With Quote