Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Bind asp

<script language="VB" runat="server">    sub Index_Changed(Sender as Object, e as EventArgs)       DataBind()    end sub </script> <html><body>    <form runat="server">       <asp:Listbox runat="server" id="lbColors"          AutoPostBack=true          rows="1"          SelectionMode="Single"          OnSelectedIndexChanged="Index_Changed" >          <asp:Listitem value="1">Red</asp:Listitem>          <asp:Listitem value=" 2">Blue</asp:Listitem>          <asp:Listitem value=" 3">Green</asp:Listitem>          <asp:Listitem value=" 4">Yellow</asp:Listitem>       </asp:Listbox>       <asp:Label id="lblMessage" runat="server"          Text='<%# lbColors.selectedItem.Text %>' />    </form> </body></html>