Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mover Listbox
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00781051
Message ID:
00781229
Vues:
21
Thanks once again for you prompt help Cathi. I'll take a look at the code you posted. I did find one example after some more digging at http://www.c-sharpcorner.com/Code/2003/Feb/AddRemoveWeb.asp if anybody is interested in it. I'm just starting to look at it but it looks like it will handle what I need.


>Brad,
>
>I haven't seen anyone create a control yet but here is some VB.NET code that Ken Cox wrote:
>
>listboxmultiple.aspx
>
><%@ Page Language="vb" AutoEventWireup="false"
>Codebehind="listboxmultiple.aspx.vb" Inherits="p450work2.listboxmultiple"  
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><html>
>  <head>
>    <title>listboxmultiple</title>
>    <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
>    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
>    <meta content="JavaScript" name="vs_defaultClientScript">
>    <meta content="http://schemas.microsoft.com/intellisense/ie5"
>name="vs_targetSchema">
>  </head>
>  <body>
>    <form id="Form1" method="post" runat="server">
>      <p><asp:listbox id="ListBox1" runat="server" selectionmode="Multiple">
>          <asp:listitem value="Red">Red</asp:listitem>
>          <asp:listitem value="Green">Green</asp:listitem>
>          <asp:listitem value="Blue">Blue</asp:listitem>
>          <asp:listitem value="White">White</asp:listitem>
>          <asp:listitem value="Black">Black</asp:listitem>
>        </asp:listbox><asp:listbox id="ListBox2"
>runat="server"></asp:listbox></p>
>      <p>
>        <asp:button id="Button1" runat="server" text="Move >"></asp:button></p>
>      <p> </p>
>    </form>
>  </body>
></html>
>
>
>listboxmultiple.aspx.vb
>
>Public Class listboxmultiple
>    Inherits System.Web.UI.Page
>  Protected WithEvents Button1 As System.Web.UI.WebControls.Button
>  Protected WithEvents ListBox2 As System.Web.UI.WebControls.ListBox
>  Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox
>
>#Region " Web Form Designer Generated Code "
>
>    'This call is required by the Web Form Designer.
>    <System.Diagnostics.DebuggerStepThrough()> Private Sub
>InitializeComponent()
>
>  End Sub
>
>    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
>System.EventArgs) Handles MyBase.Init
>        'CODEGEN: This method call is required by the Web Form Designer
>        'Do not modify it using the code editor.
>        InitializeComponent()
>    End Sub
>
>#End Region
>
>    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>System.EventArgs) Handles MyBase.Load
>        'Put user code to initialize the page here
>    End Sub
>
>  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>System.EventArgs) Handles Button1.Click
>    Dim li As ListItem
>    For Each li In ListBox1.Items
>      If li.Selected = True Then
>        ListBox2.Items.Add(New ListItem(li.Text, li.Value))
>      End If
>    Next
>    Dim x As Integer
>    For x = (ListBox1.Items.Count - 1) To 0 Step -1
>      If ListBox1.Items(x).Selected = True Then
>        ListBox1.Items.RemoveAt(ListBox1.Items.IndexOf(ListBox1.Items(x)))
>      End If
>    Next
>  End Sub
>
>End Class
>
>
>>Has anybody seen/developed a Mover Listbox to use in a web page? I can find them for Winforms like the one in the download section, but no luck finding an ASP version. TIA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform