Interrelated Listbox

Hello ,
I have two dropdowns on my selection screen
value selected by user in first drop down will determine the content of list second dropdown.
Can you please help how to implement this .......
thank you
Moderator Message: Please search before posting your question.
Edited by: Suhas Saha on Jan 2, 2012 12:04 PM

Hi, I have exactly the same problem. I even have just one object ( not an array) I want to transfer that way to another page. I doesn't work. I even got a java.lang.ClassCastException as I try to convert an Object back to the specific object I use.
I believe this is a bug or the tutorial is just wrong stating, that you can wrap any object. I even tried using Objects for everything and then casting them back. But it just gives me the java.lang.ClassCastException.
Can anyone from the Creator Team address this?

Similar Messages

  • Get selected values from Listbox control

    Hi All,
    I'm still new to SL so please bear with me.
    I have a ListBox being bound with some records from a DB.  Here's the xaml:
    <ListBox x:Name="lstClassSeries" SelectionMode="Multiple" DisplayMemberPath="Description" Grid.Row="11" Grid.Column="1"></ListBox>
    What I need is to get the values of the items that were selected and I can't seem to get it to work.  I've tried looping through the SelectedItems but there's no property for value or text.  I even tried to cast the item as a ListBoxItem but I
    get the following error:
    Unable to cast object of type 'UI.Silverlight.TransactionService.DTODropDown' to type 'System.Windows.Controls.ListBoxItem'.
    How can I get the values of the items selected?
    Thanks

    You're using windows forms style techniques with xaml.
    This is a bad idea.
    You ought to learn MVVM.
    You probably don't think you want to learn it, but trust me on this one.
    Learn MVVM as soon as you can.
    There's a selecteditems collection.
    You have to cast   to listboxitem, it has a content property which you cast to whatever you put in there originally.
    Here's a snippet.
    I have a class foo, load a bunch of them in.  Do stuff. Work out what's selected in the click event of a button.
    public class foo
    public int id {get;set;}
    public string description {get;set;}
    public partial class MainPage : UserControl
    public MainPage()
    InitializeComponent();
    lb.Items.Add(new ListBoxItem{Content=new foo{ id=1, description="a"}});
    lb.Items.Add(new ListBoxItem { Content = new foo { id = 2, description = "b" } });
    lb.Items.Add(new ListBoxItem { Content = new foo { id = 3, description = "c" } });
    private void Button_Click(object sender, RoutedEventArgs e)
    List<foo> selectedfoos = lb.SelectedItems.Cast<ListBoxItem>().Select(x=>x.Content as foo).ToList();
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • How to populate values in listbox of a field?

    HI all,
    My requirement is : i have one filed , for that i have five values,
    i want to display those five values in the list box. then i have to select one of them  and based on this field i have to display few fields in table control .
    here i am able to display the values in listbox but even i select any value , it showing the first vale only !!!!!!
    please help me in this regard.

    This is the way........
    DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.
      DATA : L_PSPNR  TYPE PROJ-PSPID,
             L_WBSE   TYPE PRPS-POSID.
    PARAMETERS : P_BPO TYPE CKIS-EXTNR
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BPO.
    DATA : BEGIN OF IT_BPO OCCURS 100,
             BPO LIKE ZCKIS-BPO,
             END OF IT_BPO.
      DYNFIELDS-FIELDNAME = 'P_PSPNR'.
      APPEND DYNFIELDS.
      CLEAR DYNFIELDS.
      DYNFIELDS-FIELDNAME = 'P_WBSE'.
      APPEND DYNFIELDS.
      CLEAR DYNFIELDS.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          DYNAME               = SY-CPROG
          DYNUMB               = SY-DYNNR
          TRANSLATE_TO_UPPER   = 'X'
        TABLES
          DYNPFIELDS           = DYNFIELDS
        EXCEPTIONS
          INVALID_ABAPWORKAREA = 1
          INVALID_DYNPROFIELD  = 2
          INVALID_DYNPRONAME   = 3
          INVALID_DYNPRONUMMER = 4
          INVALID_REQUEST      = 5
          NO_FIELDDESCRIPTION  = 6
          INVALID_PARAMETER    = 7
          UNDEFIND_ERROR       = 8
          DOUBLE_CONVERSION    = 9
          STEPL_NOT_FOUND      = 10
          OTHERS               = 11.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
    Rewards if satisfied
    Thanks

  • How can i add to a listBox items near in a new column other items ?

    The items on the right i changed the property of the listBox1 righttoleft to Yes.
    My problem is i want to build a new column for the number so each number i'm adding will be next on the left to the belong item string. And not under it like now.
    1. Maybe i need to use another control and not listBox ?
    2. How can i add column/s and also maybe adding a title to each column like: Names Id Number....?

    If you want columns, you should consider a
    ListView or
    DataGridView.

  • Goto field and listbox color formats

    i've got two questions
    1. i've scripted a functional listbox (field2) that hides or shows fields depending on options selected ('yes' opens field2a, 'no' hides field2a) but depending the option chosen i want to 'go to' an appropriate field. example: 'yes' automatically goes to field2a, 'no' proceeds to field3
    as it is the 'yes' jumps to field3 and 'no' goes back to the top of the page. is there a command/script i can enter at the end of the 'if' and 'or' statement that will place the cursor in a designated field?
    2. the list box only shows as white text on a blue background. is there a way to make it show like a regular text box (black text on a white background)?
    any help is greatly appreciated!!
    ..joseph g

    You are sure you are getting only "No" and "Yes" from your list box?
    $host.messageBox(Concat("Event value = ", event.vlaue), "Verify Event Value", 3, 1);
    if (event.value=="No") {
    this.getField("5S1").hidden = true;
    xfa.host.setFocus("8");
    }else {
    if (event.value=="Yes") {
    this.getField("5S1").hidden = false;
    xfa.host.setFocus("5S1") };
    Are your 2 fields are not in the same section, you will need to provide the full reference.

  • Select all in listbox

    Hi guys,
    I have a question.
    I have a from xml populated listbox and want to select by pushing a button all populated items in the list.
    this is my code.
    the interesting thing is, that this code works before I import xml data, but as soon as i import xml data, it doesnt work anymore.
    Do you have any idea, what the problem is and how can I fix it?
    and second question. Is it possible deselect single items, when all are selected?
    var temp1 = "";
    for (i=0;i< PAGE3.ListBox1.length.rawValue;i++){
        temp1 = temp1 + ListBox1.getDisplayItem(i) + "\n";
    ListBox1.rawValue = temp1
    Thank you in advance for any help!!
    Diana

    The code should work as long as you set "Allow Multiple Selection" at design time.
    However I will suggest small change to your code...try the following...
    var temp1 = "";
    for (i=0;i< PAGE3.ListBox1.length;i++){
        temp1 = temp1 + ListBox1.getDisplayItem(i) + "\n";
    ListBox1.rawValue = temp1
    Hold "Ctrl" btn for deselcting from the list.

  • Get All images from a website and put them in a listbox.

    Hi Everyone, I am new to Java Programming.
    I wanted to know if there is a way to get all the images in a website and put them in a listbox. And if an item is clicked in list box, view it in a picturebox.

    Harsimran_Singh wrote:
    what is the whole idea about .Net vs. Java...guys, .NET users are so friendly and helpful, they don't even judge english
    This is not putting a good impression of Java Users on me.good luck with .net. im sorry that things didnt work out with java.
    unfortunately, .net is essentially a clone of java so you may find that you will be looking
    to learn exactly the same things but for an expensive propriety platform.
    if you change your mind, read:
    [swing tutorials|http://java.sun.com/docs/books/tutorial/uiswing/]
    jlist
    listcellrenderer
    [list tutorial|http://java.sun.com/docs/books/tutorial/uiswing/components/list.html]
    [advanced list programming|http://java.sun.com/products/jfc/tsc/tech_topics/jlist_1/jlist.html]
    on your way out thank the moderators : )

  • How to select multiple values from a listbox

    Hi,
    I have a list box on my UI which is not allowing me to select multiple values
    I want to use multi select list box .. When i go to source of UI component and change that to select many listbox my page is not rendering it is giving error
    When i drag & drop the component i am unable to drop it as a multi select list box that option is not coming.
    I am working on Jdev 11.1.1.3 and I am using ADF/BC components
    How to select multiple values from a listbox ?
    Thanks,

    Hi,
    I want to use multi select list box .. When i go to source of UI component and change that to select many listbox my page is not rendering it is giving errorank
    And what is the error ?
    Frank

  • Removing selected items from listbox

    Hi ADF Experts,
    I have a selectmanylistbox with few values displaying in UI and a Remove Button at the bottom.
    User selects certain items from the listbox and clicks on Remove button. The selected items should be reomved. Can anybody suggest how to do this.
    Thanks,
    Animesh

    Duplicate of https://forums.oracle.com/thread/2562542
    User, please don't ask the same question multiple times. If you don't get the answer you want it may be because you did not give the right information and or use case me understand.
    Timo

  • Getting selected value from Listbox

    Hi,
    I have populated my listbox on the selection screen using the function module VRM_SET_VALUES.
    How do I get the value which is selected from the list box.
    Where is the selected value in the listbox stored.
    Thanks,
    Abhishek

    The code I used is:
    Another issue is that whenever I select any value in the listbox it is not displayed on the screen. It becomes blank again.
    PARAMETERS:  p_prin  AS LISTBOX VISIBLE LENGTH 30 USER-COMMAND sele.
      DATA: i_printers TYPE STANDARD TABLE OF frprlist,
            wa_printers TYPE frprlist.
      DATA: l_name  TYPE         vrm_id,
            i_list  TYPE         vrm_values,
            l_ctr   TYPE         i VALUE 0,
            wa_value LIKE LINE OF i_list.
      CLEAR: wa_value.
    Get printers
      CALL FUNCTION 'RSPO_FRONTEND_PRINTERS_FOR_DEV'
        EXPORTING
          device         = p_print
        TABLES
          list           = i_printers
        EXCEPTIONS
          no_list        = 1
          list_truncated = 2
          name_not_found = 3
          OTHERS         = 4.
      IF sy-subrc EQ 0.
    Populate to drop down box
        l_name = c_prin.
        LOOP AT i_printers INTO wa_printers.
          l_ctr = l_ctr + 1.
          wa_value-key = l_ctr.
          wa_value-text = wa_printers-prname.
          APPEND wa_value TO i_list.
          CLEAR wa_value.
        ENDLOOP.
        CALL FUNCTION 'VRM_SET_VALUES'
          EXPORTING
            id              = l_name
            values          = i_list
          EXCEPTIONS
            id_illegal_name = 1
            OTHERS          = 2.
        IF sy-subrc NE 0.
    Do nothing
        ENDIF.
      ENDIF.
      CLEAR: l_name, l_ctr, wa_value, i_list.

  • Display selected item from Listbox

    hi,
    i get <h:selectOneListbox> value from database, now i want to know which item is selected in the listbox
    my JSP code is
    <h:selectOneListbox binding="#{DynamicListBean.std_list_lbx}" id="std_list_lbx" immediate="true"
                                onchange="common_timeoutSubmitForm(this.form, 'std_list_lbx');" required="true" size="5"
                                style="height: 312px; left: 168px; top: 192px; position: absolute; width: 216px" value="#{DynamicListBean.selectedCategory1}" valueChangeListener="#{DynamicListBean.std_list_lbx_processValueChange}">
                                <f:selectItems id="listbox1SelectItems1" value="#{DynamicListBean.items1}"/>
                            </h:selectOneListbox>Java code is public String getSelectedCategory1() {    
            return selectedCategory1;
        public void setSelectedCategory1(String selectedCategory1) {
            this.selectedCategory1 = selectedCategory1;
    public void std_list_lbx_processValueChange(ValueChangeEvent vce) {
            connection();
            int n1 = 0;
            String a = "";
            if (con != null) {
                try {
                    stmt = con.createStatement();
                    String query = "select std_id, std_name from std_detail";
                    rs = stmt.executeQuery(query);
                    String iddata = "";
                    if (rs != null) {
                        while (rs.next()) {
                            iddata = rs.getString("std_id");
                      //      System.out.println(rs.getInt("std_id"));
                            stmt1 = con.createStatement();
                            String query1 = "select chpt_detail from chapter_detail right outer join std_detail on chapter_detail.std_id = std_detail.std_id where chapter_detail.std_id = " + iddata + " ";
                            String data3 = "";
                            rs1 = stmt1.executeQuery(query1);
                            if (rs1 != null) {
                                while (rs1.next()) {
                                    data3 = rs1.getString("chpt_detail");
                                    chpt_lst_lbx.setValue(data3);
                                    dList2.add(data3);
                                stmt1.close();
                                rs1.close();
                                List selectItems = new ArrayList();
                                Iterator it = dList2.listIterator();
                                while (it.hasNext()) {
                                    String label = (String) it.next();
                                    chpt_lst_lbx.setValue(label);
                                    selectItems.add(new SelectItem(label));
                                items2 = (SelectItem[]) selectItems.toArray(new SelectItem[0]);
                        stmt.close();
                        rs.close();
                        con.close();
                } catch (Exception e) {
                    System.out.println("Sorry failed to display values from the database table. " + e.getMessage());
                    System.out.println(e);
        }any idea or suggestion tell me

    You usually use the property behind value="#{DynamicListBean.selectedCategory1}" for that. But in your case you'll need the vce.getNewValue() as the valueChangeListener is been invoked before the property is been set.
    Having said that, your code is terrible. Please read on about the DAO pattern. Further on, did you know that you can also just use List<SelectItem> instead of SelectItem[] as f:selectItems value?
    If you want to populate child menu's, you may find this article useful to avoid future and painful problems: [http://balusc.blogspot.com/2007/10/populate-child-menus.html].

  • Retrieve Values From ListBox

    Hi,
    I have a ListBox populated with values. The user can select multiple values. One of the values is "OTHER". If this is selected (alone or amongst multiple selections) a text field should be turned from read only to open.
    So far I can do this only when the OTHER value is selected by itself. How can I modify my current script to accommodate for multiple selections?
    Current JavaScript:
    if (this.rawValue == "OTHER - Please Specify")
    PO.main.Subform5.OtherRegion.rawValue = "-->SPECIFY<--";
    PO.main.Subform5.OtherRegion.access = "open";
    else
    PO.main.Subform5.OtherRegion.rawValue = "------";
    PO.main.Subform5.OtherRegion.access = "readOnly";
    Thanks

    Try something like this
    <select size="1" name="tst" tabindex="3">
    <option value="item1">item1</option>
    <option value="item2">item2</option>
    <option value="item3">item3</option>
    </select>
    then in the response
    <%
    String result = request.getParameter("tst");
    out.println("You selected: " + result);
    %>
    I haven't tested this out, but I believe something like this should work

  • Reading Values from Listbox and data source into MS Office Toolkit

    Hi,
    Been trying to get this to work but making no progress and my lack of experience on labview is becoming a hinderence.
    Does anyone know how I can read the values from the listbox example attached into MS Office Toolkit for Excel?
    The values from the listbox need to be compared to mulitple values from a strain data source.
    Cheers,
    Mike.
    Attachments:
    Capture.PNG ‏62 KB

    Hi,
    Ok in the attached vi I want value from the listbox "0kg through to 10kg" to be put into the excel table in the report generation toolkit along side data from the convert strain gauge reading.
    Cheers,
    Mick.
    Attachments:
    Strain Gauge Edit2.vi ‏112 KB

  • How to get the selected items from listbox

    Regarding listbox i have two questions
    1) I want to get the selected items as per the order in which ihave selected.Presently i'm getting in the ascending order.For example after selcting the 1,2,6 if i select 3 then its giving 1,2,3,6.But i want it in the order 1,2,6,3
    2)I want to select items from a single list box to many other listboxes.(ie) my first selection should goto first,second one to the second listbox and like this.How should i write the logic.
    please give me a suggestion.

    In order to have the selected items line up in accordance to the selection order, please do it one at a time. (That's the limit for that VI)
    If you need more than that (i.e. to regconize which item clicked first and which one comes later), you may have to figure it out ya
    Wish you good luck. Perhaps, someone else has a already made vi.
    Cheers!
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com

  • How to get selected value from a listbox

    Hi !
    I use following code to fill in my LISTBOX with values :
    AT SELECTION-SCREEN OUTPUT.
      val-key = 1.
      val-text = '0016'.
      APPEND val TO list_values.
      val-key = 2.
      val-text = '0028'.
      APPEND val TO list_values.
      val-key = 3.
      val-text = '0035'.
      APPEND val TO list_values.
      val-key = 4.
      val-text = '2001'.
      APPEND val TO list_values.
      val-key = 5.
      val-text = '0515'.
      APPEND val TO list_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING id     = 'p_list'
                  values = list_values.
    My question is - how to get a selected key/text value ? i dont need it to be done dynamically - i just need it in START OF SELECTION to perform tasks.
    Thx in advance.

    Unfortunetly it does not work
    i Define parameter as follows :
    PARAMETERS:
      p_list AS LISTBOX VISIBLE LENGTH 10.
    Then i add values to it :
    AT SELECTION-SCREEN OUTPUT.
      val-key = 1.
      val-text = '0016'.
      APPEND val TO list_values.
      val-key = 2.
      val-text = '0028'.
      APPEND val TO list_values.
      val-key = 3.
      val-text = '0035'.
      APPEND val TO list_values.
      val-key = 4.
      val-text = '2001'.
      APPEND val TO list_values.
      val-key = 5.
      val-text = '0515'.
      APPEND val TO list_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING id     = 'p_list'
                  values = list_values.
    Then when i add a blank section :
    AT SELECTION-SCREEN ON p_list.
    I set a breakpoint in START OF SELECTION block - but the value is empty no matter what do i select.
    Actually when i select value from the list and hit enter key on selection screen the selection in a listbox goes empty :/
    Whats the cause of this ?
    Edited by: Jacek Zebrowski on Feb 26, 2009 12:38 PM

Maybe you are looking for

  • Adobe Illustrator CS6 Error 16 continues even after following troubleshooting guide and adding permissions.

    Error 16 continues.  I have followed the troubleshooting guide to the letter for this error and I continue to receive the error 16 when trying to open Illustrator.  Is there a work around for this?  Any suggestions would be appreciated.  I would rath

  • BOR Object and ABAP Class

    Hi,     Can anybody say when to use BOR object and Abap class in the task with an example. Thanks, Mugundhan

  • No iPhoto Found in Applications

    I just loaded on the Leopard software, and I needed to do a complete rewrite of my destination disk. Now as I am checking all my applications, I have no iphoto app and it is not on the computer. I went to download iphoto from Apple and it indicated t

  • Cannot display ods data in report

    Hi All, I have a report on multiprovider in which data from ODS cannot be displayed, in both multiprovider and report. I also checked,some of the fields from ODS have check mark in  identification(multiprovider). can any give the inputs for further a

  • IKE Trouble with Peer to Peer VPN

    Got an interesting one here.  We have three flavors of Cradlepoint router.  The early 1200, the 1200b and the 1400.  I am setting up peer tp peer VPNs.  The Cradlepoints sit in a school bus and connect to the ASA in our district office. The ASA 5510