move selected items from the list box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kabp321
    New Member
    • Oct 2007
    • 6

    #1

    move selected items from the list box

    I have two list boxes(asp.net). i want to select some items from the left side and put them into right side one and put all the selected values to another text box. How can i put the selected items into text box?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Is this a multiple select list box? Post the code you have so far.

    Comment

    • kabp321
      New Member
      • Oct 2007
      • 6

      #3
      [HTML]<tr>
      <td style="height: 20px; width: 642px;" align="left">
      <asp:Label ID="lbl_loc" runat="server" Text="Selected Values"></asp:Label>
      </td>
      <td style="height: 20px; width: 614px;" align="left" colspan="4">
      <asp:TextBox ID="txt_Loc" runat="server" Width="395px"></asp:TextBox>
      </td>
      </tr>

      <TR>
      <TD width="40%" align="center">
      <asp:listbox id="lstEmployee s" runat="server" Width="250px" Height="140" SelectionMode=" Multiple"
      BorderStyle="Ou tset">
      <asp:ListItem value="1">Akash </asp:ListItem>
      <asp:ListItem value="2">Akila </asp:ListItem>
      <asp:ListItem value="3">Danus h</asp:ListItem>
      <asp:ListItem value="4">Gokil a</asp:ListItem>
      <asp:ListItem value="5">Haris h</asp:ListItem>
      <asp:ListItem value="6">Shyaa m</asp:ListItem>
      </asp:listbox></TD>
      <TD align="center" width="10%">
      <asp:button id="btnaddall" runat="server" CssClass="butto n" Text=">>" Width="25px"></asp:button><BR>
      <asp:button id="btnadditem " runat="server" CssClass="butto n" Text=">" Width="25px"></asp:button><BR>
      <asp:button id="btnremoveit em" runat="server" CssClass="butto n" Text="<" Width="25px"></asp:button><BR>
      <asp:button id="btnremoveal l" runat="server" CssClass="butto n" Text="<<" Width="25px"></asp:button></TD>
      <TD width="40%" align="center">
      <asp:ListBox id="lstSelected Employees" Runat="server" Width="250px" Height="140" SelectionMode=" Multiple"></asp:ListBox></TD>
      <TD align="center" width="10%">
      <asp:Button id="btnColmoveu p" Runat="server" Text="^" Font-Size="13"></asp:Button><br>
      <asp:Button id="btnColmoved wn" Runat="server" Text="v" Font-Size="13"></asp:Button></TD>

      <asp:Button ID="btn_Ok" runat="server" Text="Ok" Width="25" OnClick="btn_Ok _Click"/>
      </TR>
      [/HTML]
      When i click this ok button i want to fill textbox (Selected Values )which is in the same interface
      Last edited by acoder; Dec 7 '07, 08:42 AM. Reason: Added code tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Assuming lstSelectedEmpl oyees contains the selected items, then use the select object's options[] array. If you want the text, use the 'text' property.

        Do you want them as a list separated by commas?

        What are the IDs of the elements on the client-side?

        Comment

        Working...